home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / phigs / ptk.lha / ptk / source / library / phin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-01  |  339.8 KB  |  12,805 lines

  1. /*----------------------------------------------------------------------------
  2.  
  3. Module name: Phinter.
  4.  
  5. Author: Toby Howard.
  6.  
  7. Function: PHIGS textual interpreter.
  8.  
  9. Internal function list: readstring, readinteger, readreal,
  10. readphigsenum, interpreter, popen_phigs.
  11.  
  12. External function list: ptk_phinter.
  13.  
  14. Hashtables used: "structureid".
  15.  
  16. Modification history: (Version), (Date), (Name), (Description).
  17.  
  18.  1.0, May 1986, Toby Howard, First version.
  19.  
  20.  1.1, Jan 1988, Manjula Patel, PHIGS+ additions.
  21.  
  22.  1.2, 14th July 1988, Steve Larkin, Modified to use Vax PHIGS$
  23.  and a pascal binding in 'pbind.pas'.
  24.  
  25.  2.0, May 1991, Gareth Williams, Converted to C.
  26.  
  27.  2.1, June 1991, Gareth Williams, Completed handling of all PHIGS functions.
  28.  
  29.  3.0, June 1992, Gareth Williams, Converted to ISO PHIGS C.
  30.  
  31.  3.1, July 1992, Gareth Williams, Added PHIGS PLUS bits for SunPHIGS 2.0.
  32.  
  33.  3.2, August 1992, Gareth Williams, Added bits to work with HP PHIGS 2.2.
  34.  
  35. ----------------------------------------------------------------------------*/
  36.  
  37. #include <stdio.h>
  38. #include <math.h>
  39. #include <varargs.h>
  40. #include <setjmp.h>
  41. #include <ctype.h>
  42. #ifdef SUN
  43. #include <string.h>
  44. #include <strings.h> 
  45. #endif
  46. #ifdef PEXSI
  47. #include <string.h>
  48. #include <strings.h> 
  49. #endif
  50. #include <phigs.h>
  51. #include "ptk.h"
  52.  
  53. /*--------------------------------------------------------------------------*/
  54.  
  55. #define CURRENTVERSION  3.1
  56.  
  57. #define phintermessage  " (September, 1992)"
  58.  
  59. /* PHIGS PLUS bits */
  60. #ifdef SUN
  61. #define MAXPHIGSNAMES  424  /* 319 (PHIGS) + 105 (PHIGS PLUS) */
  62. #else
  63. #define MAXPHIGSNAMES  319  /* number of phigs function names */
  64. #endif
  65.  
  66. #define default_prompt_string  "phinter"
  67.  
  68. /*--------------------------------------------------------------------------*/
  69.  
  70. /* PHIGS PLUS bits */
  71. typedef enum 
  72. {
  73. PTKEADDNAMESET,
  74. PTKEANNOTATIONTEXTRELATIVE,
  75. PTKEANNOTATIONTEXTRELATIVE3,
  76. PTKEAPPLICATIONDATA,
  77. PTKEARALLSTRUCT,
  78. PTKEARSTRUCT,
  79. PTKEARSTRUCTNET,
  80. PTKEAWAITEVENT,
  81. PTKEBUILDTRAN,
  82. PTKEBUILDTRAN3,
  83. PTKECELLARRAY,
  84. PTKECELLARRAY3,
  85. PTKECHANGESTRUCTID,
  86. PTKECHANGESTRUCTIDREF,
  87. PTKECHANGESTRUCTREF,
  88. PTKECLOSEARFILE,
  89. PTKECLOSEPHIGS,
  90. PTKECLOSESTRUCT,
  91. PTKECLOSEWS,
  92. PTKECOMPOSEMATRIX,
  93. PTKECOMPOSEMATRIX3,
  94. PTKECOMPOSETRAN,
  95. PTKECOMPOSETRAN3,
  96. PTKECOPYALLELEMSSTRUCT,
  97. PTKEDELALLSTRUCT,
  98. PTKEDELALLSTRUCTAR,
  99. PTKEDELELEM,
  100. PTKEDELELEMRANGE,
  101. PTKEDELELEMSLABELS,
  102. PTKEDELSTRUCT,
  103. PTKEDELSTRUCTNET,
  104. PTKEDELSTRUCTNETAR,
  105. PTKEDELSTRUCTAR,
  106. PTKEELEMSRCH,
  107. PTKEEMERGENCYCLOSEPHIGS,
  108. PTKEEMPTYSTRUCT,
  109. PTKEERRORHAND,
  110. PTKEERRORLOG,
  111. PTKEESCAPE,
  112. PTKEEVALVIEWMAPPINGMATRIX,
  113. PTKEEVALVIEWMAPPINGMATRIX3,
  114. PTKEEVALVIEWORIENTATIONMATRIX,
  115. PTKEEVALVIEWORIENTATIONMATRIX3,
  116. PTKEEXECUTESTRUCT,
  117. PTKEFILLAREA,
  118. PTKEFILLAREA3,
  119. PTKEFILLAREASET,
  120. PTKEFILLAREASET3,
  121. PTKEFLUSHEVENTS,
  122. PTKEGDP,
  123. PTKEGDP3,
  124. PTKEGSE,
  125. PTKEGETCHOICE,
  126. PTKEGETTYPEMF,
  127. PTKEGETLOC,
  128. PTKEGETLOC3,
  129. PTKEGETPICK,
  130. PTKEGETSTRING,
  131. PTKEGETSTROKE,
  132. PTKEGETSTROKE3,
  133. PTKEGETVAL,
  134. PTKEINCRSPASRCH,
  135. PTKEINCRSPASRCH3,
  136. PTKEINITCHOICE,
  137. PTKEINITCHOICE3,
  138. PTKEINITLOC,
  139. PTKEINITLOC3,
  140. PTKEINITPICK,
  141. PTKEINITPICK3,
  142. PTKEINITSTRING,
  143. PTKEINITSTRING3,
  144. PTKEINITSTROKE,
  145. PTKEINITSTROKE3,
  146. PTKEINITVAL,
  147. PTKEINITVAL3,
  148. PTKEINQALLCONFSTRUCT,
  149. PTKEINQANNOTATIONFACIL,
  150. PTKEINQARFILES,
  151. PTKEINQARST,
  152. PTKEINQCHOICEST,
  153. PTKEINQCHOICEST3,
  154. PTKEINQCOLOURFACIL,
  155. PTKEINQCOLOURMODEL,
  156. PTKEINQCOLOURMODELFACIL,
  157. PTKEINQCOLOURREP,
  158. PTKEINQCONFRES,
  159. PTKEINQCONFSTRUCTINNET,
  160. PTKEINQCURELEMCONTENT,
  161. PTKEINQCURELEMTYPESIZE,
  162. PTKEINQDEFCHOICEDATA,
  163. PTKEINQDEFCHOICEDATA3,
  164. PTKEINQDEFDISPLAYUPDATEST,
  165. PTKEINQDEFLOCDATA,
  166. PTKEINQDEFLOCDATA3,
  167. PTKEINQDEFPICKDATA,
  168. PTKEINQDEFPICKDATA3,
  169. PTKEINQDEFSTRINGDATA,
  170. PTKEINQDEFSTRINGDATA3,
  171. PTKEINQDEFSTROKEDATA,
  172. PTKEINQDEFSTROKEDATA3,
  173. PTKEINQDEFVALDATA,
  174. PTKEINQDEFVALDATA3,
  175. PTKEINQDISPLAYSPACESIZE,
  176. PTKEINQDISPLAYSPACESIZE3,
  177. PTKEINQDISPLAYUPDATEST,
  178. PTKEINQDYNSTRUCT,
  179. PTKEINQDYNWSATTR,
  180. PTKEINQEDGEFACIL,
  181. PTKEINQEDGEREP,
  182. PTKEINQEDITMODE,
  183. PTKEINQELEMCONTENT,
  184. PTKEINQELEMPTR,
  185. PTKEINQELEMTYPESIZE,
  186. PTKEINQERRORHANDMODE,
  187. PTKEINQGDP,
  188. PTKEINQGDP3,
  189. PTKEINQGSEFACIL,
  190. PTKEINQHILIGHTFILTER,
  191. PTKEINQHLHSRFACIL,
  192. PTKEINQHLHSRMODE,
  193. PTKEINQINPUTOVERFLOW,
  194. PTKEINQINTFACIL,
  195. PTKEINQINTREP,
  196. PTKEINQINVISFILTER,
  197. PTKEINQAVAILGDP,
  198. PTKEINQAVAILGDP3,
  199. PTKEINQGSE,
  200. PTKEINQWSTYPES,
  201. PTKEINQCOLOURIND,
  202. PTKEINQEDGEIND,
  203. PTKEINQINTIND,
  204. PTKEINQPATIND,
  205. PTKEINQLINEIND,
  206. PTKEINQMARKERIND,
  207. PTKEINQTEXTIND,
  208. PTKEINQVIEWIND,
  209. PTKEINQLOCST,
  210. PTKEINQLOCST3,
  211. PTKEINQMODELCLIPFACIL,
  212. PTKEINQMOREEVENTS,
  213. PTKEINQNUMINPUT,
  214. PTKEINQNUMDISPLAYPRI,
  215. PTKEINQOPENSTRUCT,
  216. PTKEINQANCESSTRUCT,
  217. PTKEINQDESCSTRUCT,
  218. PTKEINQPATFACIL,
  219. PTKEINQPATREP,
  220. PTKEINQPHIGSFACIL,
  221. PTKEINQPICKST,
  222. PTKEINQPICKST3,
  223. PTKEINQLINEFACIL,
  224. PTKEINQLINEREP,
  225. PTKEINQMARKERFACIL,
  226. PTKEINQMARKERREP,
  227. PTKEINQPOSTEDSTRUCT,
  228. PTKEINQPREDCOLOURREP,
  229. PTKEINQPREDEDGEREP,
  230. PTKEINQPREDINTREP,
  231. PTKEINQPREDPATREP,
  232. PTKEINQPREDLINEREP,
  233. PTKEINQPREDMARKERREP,
  234. PTKEINQPREDTEXTREP,
  235. PTKEINQPREDVIEWREP,
  236. PTKEINQSETOPENWS,
  237. PTKEINQSETWSPOSTED,
  238. PTKEINQSTRINGST,
  239. PTKEINQSTRINGST3,
  240. PTKEINQSTROKEST,
  241. PTKEINQSTROKEST3,
  242. PTKEINQSTRUCTIDS,
  243. PTKEINQSTRUCTST,
  244. PTKEINQSTRUCTSTATUS,
  245. PTKEINQSYSTEMST,
  246. PTKEINQTEXTEXTENT,
  247. PTKEINQTEXTFACIL,
  248. PTKEINQTEXTREP,
  249. PTKEINQVALST,
  250. PTKEINQVALST3,
  251. PTKEINQVIEWFACIL,
  252. PTKEINQVIEWREP,
  253. PTKEINQWSCATEGORY,
  254. PTKEINQWSCLASS,
  255. PTKEINQWSCONNTYPE,
  256. PTKEINQWSST,
  257. PTKEINQWSSTTABLE,
  258. PTKEINQWSTRAN,
  259. PTKEINQWSTRAN3,
  260. PTKEINTERPRET,
  261. PTKELABEL,
  262. PTKEMESSAGE,
  263. PTKEOFFSETELEMPTR,
  264. PTKEOPENARFILE,
  265. PTKEOPENPHIGS,
  266. PTKEOPENSTRUCT,
  267. PTKEOPENWS,
  268. PTKEPOLYLINE,
  269. PTKEPOLYLINE3,
  270. PTKEPOLYMARKER,
  271. PTKEPOLYMARKER3,
  272. PTKEPOSTSTRUCT,
  273. PTKEREADMF,
  274. PTKEREDRAWALLSTRUCT,
  275. PTKEREMOVENAMESET,
  276. PTKEREQCHOICE,
  277. PTKEREQLOC,
  278. PTKEREQLOC3,
  279. PTKEREQPICK,
  280. PTKEREQSTRING,
  281. PTKEREQSTROKE,
  282. PTKEREQSTROKE3,
  283. PTKEREQVAL,
  284. PTKERESTOREMODELCLIPVOLUME,
  285. PTKERETRIEVEALLSTRUCT,
  286. PTKERETRIEVEANCESSTRUCT,
  287. PTKERETRIEVEDESCSTRUCT,
  288. PTKERETRIEVESTRUCTIDS,
  289. PTKERETRIEVESTRUCT,
  290. PTKERETRIEVESTRUCTNET,
  291. PTKEROTATE,
  292. PTKEROTATEX,
  293. PTKEROTATEY,
  294. PTKEROTATEZ,
  295. PTKESAMPLECHOICE,
  296. PTKESAMPLELOC,
  297. PTKESAMPLELOC3,
  298. PTKESAMPLEPICK,
  299. PTKESAMPLESTRING,
  300. PTKESAMPLESTROKE,
  301. PTKESAMPLESTROKE3,
  302. PTKESAMPLEVAL,
  303. PTKESCALE,
  304. PTKESCALE3,
  305. #ifdef SUN
  306. PTKESETEDGECOLR,
  307. PTKESETINTCOLR,
  308. PTKESETLINECOLR,
  309. PTKESETMARKERCOLR,
  310. PTKESETTEXTCOLR,
  311. #endif
  312. PTKESETANNOTATIONSTYLE,
  313. PTKESETANNOTATIONALIGN,
  314. PTKESETANNOTATIONCHARHEIGHT,
  315. PTKESETANNOTATIONCHARUP,
  316. PTKESETANNOTATIONPATH,
  317. PTKESETCHAREXPAN,
  318. PTKESETCHARHEIGHT,
  319. PTKESETCHARSPACE,
  320. PTKESETCHARUP,
  321. PTKESETCHOICEMODE,
  322. PTKESETCOLOURMODEL,
  323. PTKESETCOLOURREP,
  324. PTKESETCONFRES,
  325. PTKESETDISPLAYUPDATEST,
  326. PTKESETEDGECOLOURIND,
  327. PTKESETEDGEFLAG,
  328. PTKESETEDGEIND,
  329. PTKESETEDGEREP,
  330. PTKESETEDGETYPE,
  331. PTKESETEDGEWIDTH,
  332. PTKESETEDITMODE,
  333. PTKESETELEMPTR,
  334. PTKESETELEMPTRLABEL,
  335. PTKESETERRORHANDMODE,
  336. PTKESETGLOBALTRAN,
  337. PTKESETGLOBALTRAN3,
  338. PTKESETHILIGHTFILTER,
  339. PTKESETHLHSRID,
  340. PTKESETHLHSRMODE,
  341. PTKESETINDIVASF,
  342. PTKESETINTCOLOURIND,
  343. PTKESETINTIND,
  344. PTKESETINTREP,
  345. PTKESETINTSTYLE,
  346. PTKESETINTSTYLEIND,
  347. PTKESETINVISFILTER,
  348. PTKESETLINETYPE,
  349. PTKESETLINEWIDTH,
  350. PTKESETLOCALTRAN,
  351. PTKESETLOCALTRAN3,
  352. PTKESETLOCMODE,
  353. PTKESETMARKERSIZE,
  354. PTKESETMARKERTYPE,
  355. PTKESETMODELCLIPINDICATOR,
  356. PTKESETMODELCLIPVOLUME,
  357. PTKESETMODELCLIPVOLUME3,
  358. PTKESETPATREFPT,
  359. PTKESETPATREFPTVECTORS,
  360. PTKESETPATREP,
  361. PTKESETPATSIZE,
  362. PTKESETPICKFILTER,
  363. PTKESETPICKID,
  364. PTKESETPICKMODE,
  365. PTKESETLINECOLOURIND,
  366. PTKESETLINEIND,
  367. PTKESETLINEREP,
  368. PTKESETMARKERCOLOURIND,
  369. PTKESETMARKERIND,
  370. PTKESETMARKERREP,
  371. PTKESETSTRINGMODE,
  372. PTKESETSTROKEMODE,
  373. PTKESETTEXTALIGN,
  374. PTKESETTEXTCOLOURIND,
  375. PTKESETTEXTFONT,
  376. PTKESETTEXTIND,
  377. PTKESETTEXTPATH,
  378. PTKESETTEXTPREC,
  379. PTKESETTEXTREP,
  380. PTKESETVALMODE,
  381. PTKESETVIEWIND,
  382. PTKESETVIEWREP,
  383. PTKESETVIEWREP3,
  384. PTKESETVIEWTRANINPUTPRI,
  385. PTKESETWSVIEWPORT,
  386. PTKESETWSVIEWPORT3,
  387. PTKESETWSWINDOW,
  388. PTKESETWSWINDOW3,
  389. PTKETEXT,
  390. PTKETEXT3,
  391. PTKETRANPT,
  392. PTKETRANPT3,
  393. PTKETRANSLATE,
  394. PTKETRANSLATE3,
  395. PTKEUNPOSTALLSTRUCT,
  396. PTKEUNPOSTSTRUCT,
  397. PTKEUPDATEWS,
  398. PTKEWRITEMF,
  399. #ifdef SUN
  400. PTKECELLARRAY3PLUS,
  401. PTKECOMPFILLAREASETGNORM,
  402. PTKEFILLAREASETDATA,
  403. PTKEFILLAREASET3DATA,
  404. PTKEINQCOLRMAPFACS,
  405. PTKEINQCOLRMAPMETHODFACS,
  406. PTKEINQCOLRMAPREP,
  407. PTKEINQCOLRMAPST,
  408. PTKEINQCURVSURFFACS,
  409. PTKEINQDATAMAPFACS,
  410. PTKEINQDATAMAPREP,
  411. PTKEINQDCUEFACS,
  412. PTKEINQDCUEREP,
  413. PTKEINQDIRECTCOLRMODELFACS,
  414. PTKEINQDYNSWSATTRSPLUS,
  415. PTKEINQEDGEREPPLUS,
  416. PTKEINQINTFACSPLUS,
  417. PTKEINQINTREPPLUS,
  418. PTKEINQLIGHTSRCFACS,
  419. PTKEINQLIGHTSRCREP,
  420. PTKEINQLISTCOLRMAPINDS,
  421. PTKEINQLISTDATAMAPINDS,
  422. PTKEINQLISTDCUEINDS,
  423. PTKEINQLISTLIGHTSRCINDS,
  424. PTKEINQLISTPARAMSURFINDS,
  425. PTKEINQLISTREFLINDS,
  426. PTKEINQPARAMSURFREP,
  427. PTKEINQPATREPPLUS,
  428. PTKEINQLINEFACSPLUS,
  429. PTKEINQLINEREPPLUS,
  430. PTKEINQMARKERREPPLUS,
  431. PTKEINQPREDCOLRMAPREP,
  432. PTKEINQPREDDATAMAPREP,
  433. PTKEINQPREDDCUEREP,
  434. PTKEINQPREDEDGEREPPLUS,
  435. PTKEINQPREDINTREPPLUS,
  436. PTKEINQPREDLIGHTSRCREP,
  437. PTKEINQPREDPARAMSURFREP,
  438. PTKEINQPREDPATREPPLUS,
  439. PTKEINQPREDLINEREPPLUS,
  440. PTKEINQPREDMARKERREPPLUS,
  441. PTKEINQPREDREFLREP,
  442. PTKEINQPREDTEXTREPPLUS,
  443. PTKEINQREFLFACS,
  444. PTKEINQREFLREP,
  445. PTKEINQRENDERINGCOLRMODELFACS,
  446. PTKEINQTEXTREPPLUS,
  447. PTKEINQWSSTTABLEPLUS,
  448. PTKENUNIBSPLCURV,
  449. PTKENUNIBSPLCURVCOLR,
  450. PTKENUNIBSPLSURF,
  451. PTKENUNIBSPLSURFDATA,
  452. PTKEPOLYLINESET3DATA,
  453. PTKEQUADMESHDATA,
  454. PTKEQUADMESH3DATA,
  455. PTKESETBACKDATAMAPIND,
  456. PTKESETBACKDATAMAPMETH,
  457. PTKESETBACKINTCOLR,
  458. PTKESETBACKINTIND,
  459. PTKESETBACKINTSHADMETH,
  460. PTKESETBACKINTSTYLE,
  461. PTKESETBACKINTSTYLEIND,
  462. PTKESETBACKREFLIND,
  463. PTKESETBACKREFLMODEL,
  464. PTKESETBACKREFLPROPS,
  465. PTKESETCOLRMAPIND,
  466. PTKESETCOLRMAPREP,
  467. PTKESETCURVAPPROX,
  468. PTKESETDATAMAPIND,
  469. PTKESETDATAMAPMETH,
  470. PTKESETDATAMAPREP,
  471. PTKESETDCUEIND,
  472. PTKESETDCUEREP,
  473. PTKESETEDGEREPPLUS,
  474. PTKESETFACECULLMODE,
  475. PTKESETFACEDISTINGMODE,
  476. PTKESETINTREPPLUS,
  477. PTKESETINTSHADMETH,
  478. PTKESETLIGHTSRCREP,
  479. PTKESETLIGHTSRCSTATE,
  480. PTKESETOFFILLAREASETDATA,
  481. PTKESETOFFILLAREASET3DATA,
  482. PTKESETPARAMSURFCHARACS,
  483. PTKESETPARAMSURFIND,
  484. PTKESETPARAMSURFREP,
  485. PTKESETPATREPPLUS,
  486. PTKESETLINEREPPLUS,
  487. PTKESETLINESHADMETH,
  488. PTKESETMARKERREPPLUS,
  489. PTKESETREFLIND,
  490. PTKESETREFLMODEL,
  491. PTKESETREFLPROPS,
  492. PTKESETREFLREP,
  493. PTKESETRENDERINGCOLRMODEL,
  494. PTKESETSURFAPPROX,
  495. PTKESETTEXTREPPLUS,
  496. PTKETRISETDATA,
  497. PTKETRISET3DATA,
  498. PTKETRISTRIPDATA,
  499. PTKETRISTRIP3DATA
  500. #endif
  501. } ptkephigsnames;
  502.  
  503. /* PHIGS PLUS bits */
  504. typedef enum
  505. {
  506. PTKEWSDEP,
  507. PTKESYSTEMSTATE,
  508. PTKEWSSTATE,
  509. PTKESTRUCTSTATE,
  510. PTKESTRUCTSTATUS,
  511. PTKEARCHIVESTATE,
  512. PTKEWSCLASS,
  513. PTKEWSCAT,
  514. PTKECONTROL,
  515. PTKEREGEN,
  516. PTKEDEFMODE,
  517. PTKEMOD,
  518. PTKESIMULTEV,
  519. PTKESTRUCTNETSRC,
  520. PTKEDSPSURF,
  521. PTKEVISUALREP,
  522. PTKETXPREC,
  523. PTKETXPATH,
  524. PTKETXHOR,
  525. PTKETXVER,
  526. PTKEINTERSTYLE,
  527. PTKEEDGEF,
  528. PTKEATTRID,
  529. PTKEASF,
  530. PTKECOAVAIL,
  531. PTKECOMPTYPE,
  532. PTKEPROJTYPE,
  533. PTKECLIP,
  534. PTKEVPRI,
  535. PTKECONFRES,
  536. PTKEPFCF,
  537. PTKEPATHORDER,
  538. PTKEIMODE,
  539. PTKEESW,
  540. PTKEISTATUS,
  541. PTKEOPENSTRUCTSTATUS,
  542. PTKEICLASS,
  543. PTKEPRF,
  544. PTKEINQTYPE,
  545. PTKEUPDATEST,
  546. PTKEDEVUNITS,
  547. PTKEMODTYPE,
  548. PTKEATTRS,
  549. PTKEELTYPE,
  550. PTKEEDITMODE,
  551. PTKEREFF,
  552. PTKEERRORMODE,
  553. PTKESRCHDIR,
  554. PTKESRCHSTATUS,
  555. PTKESRCHELTYPE,
  556. #ifdef SUN
  557. PTKEBASENAME,
  558. PTKEWSTYPEATTR,
  559. PTKEACCUSAGE,
  560. PTKEDBLBUFF,
  561. PTKECURSORTYPE,
  562. PTKECOLOURMODE,
  563. PTKECGMENCODING,
  564. PTKECGMCONFORMANCE,
  565. PTKECGMVDCPRECISION,
  566. PTKEBGCLEAR,
  567. PTKEUSEDECOMP,
  568. PTKEDCMODEL,
  569. PTKESIMULATEPICK,
  570. #endif
  571. #ifdef PEXSI
  572. PTKEBASENAME,
  573. PTKEWSTYPEATTR,
  574. PTKEACCUSAGE,
  575. PTKEDBLBUFF,
  576. PTKECURSORTYPE,
  577. PTKECOLOURMODE,
  578. PTKECGMENCODING,
  579. PTKECGMCONFORMANCE,
  580. PTKECGMVDCPRECISION,
  581. PTKEBGCLEAR,
  582. PTKEUSEDECOMP,
  583. PTKEDCMODEL,
  584. PTKESIMULATEPICK,
  585. #endif
  586. #ifdef SUN
  587. PTKEDCUEMODE,
  588. PTKERATIONAL,
  589. PTKECULLMODE,
  590. PTKEDISTINGMODE,
  591. PTKECURVEPLACE
  592. #endif
  593. } ptkephigsenum;
  594.  
  595. #ifdef SUN
  596. typedef enum
  597. {
  598. BASE_NAME,
  599. DOUBLE_BUFFER,
  600. NORM_CURSOR_TYPE,
  601. NORM_CURSOR_COLOUR,
  602. TRAV_CURSOR_TYPE,
  603. TRAV_CURSOR_COLOUR,
  604. ACCELERATOR_USAGE,
  605. COLOUR_MODE,
  606. TOOL_WIDTH,
  607. TOOL_HEIGHT,
  608. TOOL_X,
  609. TOOL_Y,
  610. TOOL_LABEL,
  611. TOOL_ICON_FILE,
  612. TOOL_FOREGROUND_COLOUR,
  613. TOOL_BACKGROUND_COLOUR,
  614. TOOL_SHOW_LABEL,
  615. TOOL_ICON_LABEL,
  616. TOOL_BORDER_WIDTH, 
  617. WS_CATEGORY,
  618. COLOUR_TABLE_SIZE,
  619. WST_NUM_VIEW_REP,
  620. X_CMAP_PROP_ATOM,
  621. DC_MODEL,
  622. SIMULATE_PICK,
  623. STEREO,
  624. X_DISPLAY_NAME,
  625. CGM_ENCODING,
  626. CGM_CONFORMANCE,
  627. CGM_METRIC_HEIGHT_PTR,
  628. CGM_METRIC_WIDTH_PTR,
  629. CGM_METRIC_LINE_WIDTH_PTR,
  630. CGM_VDC_PRECISION,
  631. REGION_RECT,
  632. REGION_PRIORITY,
  633. REGION_BACKGROUND,
  634. USE_DECOMP
  635. } ptkewstypeattr;
  636. #endif
  637.  
  638. #ifdef PEXSI
  639. typedef enum
  640. {
  641. BASE_NAME,
  642. DOUBLE_BUFFER,
  643. NORM_CURSOR_TYPE,
  644. NORM_CURSOR_COLOUR,
  645. TRAV_CURSOR_TYPE,
  646. TRAV_CURSOR_COLOUR,
  647. ACCELERATOR_USAGE,
  648. COLOUR_MODE,
  649. TOOL_WIDTH,
  650. TOOL_HEIGHT,
  651. TOOL_X,
  652. TOOL_Y,
  653. TOOL_LABEL,
  654. TOOL_ICON_FILE,
  655. TOOL_FOREGROUND_COLOUR,
  656. TOOL_BACKGROUND_COLOUR,
  657. TOOL_SHOW_LABEL,
  658. TOOL_ICON_LABEL,
  659. TOOL_BORDER_WIDTH, 
  660. WS_CATEGORY,
  661. COLOUR_TABLE_SIZE,
  662. WST_NUM_VIEW_REP,
  663. X_CMAP_PROP_ATOM,
  664. DC_MODEL,
  665. SIMULATE_PICK,
  666. STEREO,
  667. X_DISPLAY_NAME,
  668. CGM_ENCODING,
  669. CGM_CONFORMANCE,
  670. CGM_METRIC_HEIGHT_PTR,
  671. CGM_METRIC_WIDTH_PTR,
  672. CGM_METRIC_LINE_WIDTH_PTR,
  673. CGM_VDC_PRECISION,
  674. REGION_RECT,
  675. REGION_PRIORITY,
  676. REGION_BACKGROUND,
  677. USE_DECOMP
  678. } ptkewstypeattr;
  679. #endif
  680.  
  681. typedef enum 
  682. {
  683.   EXITERR, WARNING, INFORM, POPREQ
  684. } ptkeseverity;
  685.  
  686. typedef enum ptkehashtable 
  687. {
  688.   PTKESTRUCTID,
  689.   PTKEPICKID,
  690.   PTKELABELVAL,
  691.   PTKEVIEWIND,
  692.   PTKECOLOURIND,
  693.   PTKENAME,
  694.   PTKENOTABLE
  695. } ptkehashtable;
  696.  
  697. typedef enum ptkedest 
  698. {
  699.   PTKEOUTPUT,
  700.   PTKEINFORM,
  701.   PTKESTDOUT
  702. } ptkedest;
  703.  
  704. /*-------------------------- static variables ------------------------------*/
  705.  
  706. /* PHIGS PLUS bits */
  707. static char *phigsnamelist[MAXPHIGSNAMES] = 
  708. {
  709. "add_names_to_set",
  710. "annotation_text_relative",
  711. "annotation_text_relative3",
  712. "application_data",
  713. "archive_all_structures",
  714. "archive_structures",
  715. "archive_structure_networks",
  716. "await_event",
  717. "build_transformation_matrix",
  718. "build_transformation_matrix3",
  719. "cell_array",
  720. "cell_array3",
  721. "change_structure_identifier",
  722. "change_structure_identifier_and_references",
  723. "change_structure_references",
  724. "close_archive_file",
  725. "close_phigs",
  726. "close_structure",
  727. "close_workstation",
  728. "compose_matrix",
  729. "compose_matrix3",
  730. "compose_transformation_matrix",
  731. "compose_transformation_matrix3",
  732. "copy_all_elements_from_structure",
  733. "delete_all_structures",
  734. "delete_all_structures_from_archive",
  735. "delete_element",
  736. "delete_element_range",
  737. "delete_elements_between_labels",
  738. "delete_structure",
  739. "delete_structure_network",
  740. "delete_structure_networks_from_archive",
  741. "delete_structures_from_archive",
  742. "element_search",
  743. "emergency_close_phigs",
  744. "empty_structure",
  745. "error_handling",
  746. "error_logging",
  747. "escape",
  748. "evaluate_view_mapping_matrix",
  749. "evaluate_view_mapping_matrix3",
  750. "evaluate_view_orientation_matrix",
  751. "evaluate_view_orientation_matrix3",
  752. "execute_structure",
  753. "fill_area",
  754. "fill_area3",
  755. "fill_area_set",
  756. "fill_area_set3",
  757. "flush_device_events",
  758. "generalized_drawing_primitive",
  759. "generalized_drawing_primitive3",
  760. "generalized_structure_element",
  761. "get_choice",
  762. "get_item_type_from_metafile",
  763. "get_locator",
  764. "get_locator3",
  765. "get_pick",
  766. "get_string",
  767. "get_stroke",
  768. "get_stroke3",
  769. "get_valuator",
  770. "incremental_spatial_search",
  771. "incremental_spatial_search3",
  772. "initialize_choice",
  773. "initialize_choice3",
  774. "initialize_locator",
  775. "initialize_locator3",
  776. "initialize_pick",
  777. "initialize_pick3",
  778. "initialize_string",
  779. "initialize_string3",
  780. "initialize_stroke",
  781. "initialize_stroke3",
  782. "initialize_valuator",
  783. "initialize_valuator3",
  784. "inquire_all_conflicting_structures",
  785. "inquire_annotation_facilities",
  786. "inquire_archive_files",
  787. "inquire_archive_state_value",
  788. "inquire_choice_device_state",
  789. "inquire_choice_device_state3",
  790. "inquire_colour_facilities",
  791. "inquire_colour_model",
  792. "inquire_colour_model_facilities",
  793. "inquire_colour_representation",
  794. "inquire_conflict_resolution",
  795. "inquire_conflicting_structures_in_network",
  796. "inquire_current_element_content",
  797. "inquire_current_element_type_and_size",
  798. "inquire_default_choice_device_data",
  799. "inquire_default_choice_device_data3",
  800. "inquire_default_display_update_state",
  801. "inquire_default_locator_device_data",
  802. "inquire_default_locator_device_data3",
  803. "inquire_default_pick_device_data",
  804. "inquire_default_pick_device_data3",
  805. "inquire_default_string_device_data",
  806. "inquire_default_string_device_data3",
  807. "inquire_default_stroke_device_data",
  808. "inquire_default_stroke_device_data3",
  809. "inquire_default_valuator_device_data",
  810. "inquire_default_valuator_device_data3",
  811. "inquire_display_space_size",
  812. "inquire_display_space_size3",
  813. "inquire_display_update_state",
  814. "inquire_dynamics_of_structures",
  815. "inquire_dynamics_of_workstation_attributes",
  816. "inquire_edge_facilities",
  817. "inquire_edge_representation",
  818. "inquire_edit_mode",
  819. "inquire_element_content",
  820. "inquire_element_pointer",
  821. "inquire_element_type_and_size",
  822. "inquire_error_handling_mode",
  823. "inquire_generalized_drawing_primitive",
  824. "inquire_generalized_drawing_primitive3",
  825. "inquire_generalized_structure_element_facilities",
  826. "inquire_highlighting_filter",
  827. "inquire_hlhsr_facilities",
  828. "inquire_hlhsr_mode",
  829. "inquire_input_queue_overflow",
  830. "inquire_interior_facilities",
  831. "inquire_interior_representation",
  832. "inquire_invisibility_filter",
  833. "inquire_list_of_available_generalized_drawing_primitives",
  834. "inquire_list_of_available_generalized_drawing_primitives3",
  835. "inquire_list_of_available_generalized_structure_elements",
  836. "inquire_list_of_available_workstation_types",
  837. "inquire_list_of_colour_indices",
  838. "inquire_list_of_edge_indices",
  839. "inquire_list_of_interior_indices",
  840. "inquire_list_of_pattern_indices",
  841. "inquire_list_of_polyline_indices",
  842. "inquire_list_of_polymarker_indices",
  843. "inquire_list_of_text_indices",
  844. "inquire_list_of_view_indices",
  845. "inquire_locator_device_state",
  846. "inquire_locator_device_state3",
  847. "inquire_modelling_clipping_facilities",
  848. "inquire_more_simultaneous_events",
  849. "inquire_number_of_available_logical_input_devices",
  850. "inquire_number_of_display_priorities_supported",
  851. "inquire_open_structure",
  852. "inquire_paths_to_ancestors",
  853. "inquire_paths_to_descendants",
  854. "inquire_pattern_facilities",
  855. "inquire_pattern_representation",
  856. "inquire_phigs_facilities",
  857. "inquire_pick_device_state",
  858. "inquire_pick_device_state3",
  859. "inquire_polyline_facilities",
  860. "inquire_polyline_representation",
  861. "inquire_polymarker_facilities",
  862. "inquire_polymarker_representation",
  863. "inquire_posted_structures",
  864. "inquire_predefined_colour_representation",
  865. "inquire_predefined_edge_representation",
  866. "inquire_predefined_interior_representation",
  867. "inquire_predefined_pattern_representation",
  868. "inquire_predefined_polyline_representation",
  869. "inquire_predefined_polymarker_representation",
  870. "inquire_predefined_text_representation",
  871. "inquire_predefined_view_representation",
  872. "inquire_set_of_open_workstations",
  873. "inquire_set_of_workstations_to_which_posted",
  874. "inquire_string_device_state",
  875. "inquire_string_device_state3",
  876. "inquire_stroke_device_state",
  877. "inquire_stroke_device_state3",
  878. "inquire_structure_identifiers",
  879. "inquire_structure_state_value",
  880. "inquire_structure_status",
  881. "inquire_system_state_value",
  882. "inquire_text_extent",
  883. "inquire_text_facilities",
  884. "inquire_text_representation",
  885. "inquire_valuator_device_state",
  886. "inquire_valuator_device_state3",
  887. "inquire_view_facilities",
  888. "inquire_view_representation",
  889. "inquire_workstation_category",
  890. "inquire_workstation_classification",
  891. "inquire_workstation_connection_and_type",
  892. "inquire_workstation_state_value",
  893. "inquire_workstation_state_table_lengths",
  894. "inquire_workstation_transformation",
  895. "inquire_workstation_transformation3",
  896. "interpret_item",
  897. "label",
  898. "message",
  899. "offset_element_pointer",
  900. "open_archive_file",
  901. "open_phigs",
  902. "open_structure",
  903. "open_workstation",
  904. "polyline",
  905. "polyline3",
  906. "polymarker",
  907. "polymarker3",
  908. "post_structure",
  909. "read_item_from_metafile",
  910. "redraw_all_structures",
  911. "remove_names_from_set",
  912. "request_choice",
  913. "request_locator",
  914. "request_locator3",
  915. "request_pick",
  916. "request_string",
  917. "request_stroke",
  918. "request_stroke3",
  919. "request_valuator",
  920. "restore_modelling_clipping_volume",
  921. "retrieve_all_structures",
  922. "retrieve_paths_to_ancestors",
  923. "retrieve_paths_to_descendants",
  924. "retrieve_structure_identifiers",
  925. "retrieve_structures",
  926. "retrieve_structure_networks",
  927. "rotate",
  928. "rotate_x",
  929. "rotate_y",
  930. "rotate_z",
  931. "sample_choice",
  932. "sample_locator",
  933. "sample_locator3",
  934. "sample_pick",
  935. "sample_string",
  936. "sample_stroke",
  937. "sample_stroke3",
  938. "sample_valuator",
  939. "scale",
  940. "scale3",
  941. #ifdef SUN
  942. "set_edge_colour",
  943. "set_interior_colour",
  944. "set_polyline_colour",
  945. "set_polymarker_colour",
  946. "set_text_colour",
  947. #endif
  948. "set_annotation_style",
  949. "set_annotation_text_alignment",
  950. "set_annotation_text_character_height",
  951. "set_annotation_text_character_up_vector",
  952. "set_annotation_text_path",
  953. "set_character_expansion_factor",
  954. "set_character_height",
  955. "set_character_spacing",
  956. "set_character_up_vector",
  957. "set_choice_mode",
  958. "set_colour_model",
  959. "set_colour_representation",
  960. "set_conflict_resolution",
  961. "set_display_update_state",
  962. "set_edge_colour_index",
  963. "set_edge_flag",
  964. "set_edge_index",
  965. "set_edge_representation",
  966. "set_edgetype",
  967. "set_edgewidth_scale_factor",
  968. "set_edit_mode",
  969. "set_element_pointer",
  970. "set_element_pointer_at_label",
  971. "set_error_handling_mode",
  972. "set_global_transformation",
  973. "set_global_transformation3",
  974. "set_highlighting_filter",
  975. "set_hlhsr_identifier",
  976. "set_hlhsr_mode",
  977. "set_individual_asf",
  978. "set_interior_colour_index",
  979. "set_interior_index",
  980. "set_interior_representation",
  981. "set_interior_style",
  982. "set_interior_style_index",
  983. "set_invisibility_filter",
  984. "set_linetype",
  985. "set_linewidth_scale_factor",
  986. "set_local_transformation",
  987. "set_local_transformation3",
  988. "set_locator_mode",
  989. "set_marker_size_scale_factor",
  990. "set_marker_type",
  991. "set_modelling_clipping_indicator",
  992. "set_modelling_clipping_volume",
  993. "set_modelling_clipping_volume3",
  994. "set_pattern_reference_point",
  995. "set_pattern_reference_point_and_vectors",
  996. "set_pattern_representation",
  997. "set_pattern_size",
  998. "set_pick_filter",
  999. "set_pick_identifier",
  1000. "set_pick_mode",
  1001. "set_polyline_colour_index",
  1002. "set_polyline_index",
  1003. "set_polyline_representation",
  1004. "set_polymarker_colour_index",
  1005. "set_polymarker_index",
  1006. "set_polymarker_representation",
  1007. "set_string_mode",
  1008. "set_stroke_mode",
  1009. "set_text_alignment",
  1010. "set_text_colour_index",
  1011. "set_text_font",
  1012. "set_text_index",
  1013. "set_text_path",
  1014. "set_text_precision",
  1015. "set_text_representation",
  1016. "set_valuator_mode",
  1017. "set_view_index",
  1018. "set_view_representation",
  1019. "set_view_representation3",
  1020. "set_view_transformation_input_priority",
  1021. "set_workstation_viewport",
  1022. "set_workstation_viewport3",
  1023. "set_workstation_window",
  1024. "set_workstation_window3",
  1025. "text",
  1026. "text3",
  1027. "transform_point",
  1028. "transform_point3",
  1029. "translate",
  1030. "translate3",
  1031. "unpost_all_structures",
  1032. "unpost_structure",
  1033. "update_workstation",
  1034. "write_item_to_metafile",
  1035. #ifdef SUN
  1036. "cell_array3_plus",
  1037. "compute_fill_area_set_geometric_normal",
  1038. "fill_area_set_with_data",
  1039. "fill_area_set3_with_data",
  1040. "inquire_colour_mapping_facilities",
  1041. "inquire_colour_mapping_method_facilities",
  1042. "inquire_colour_mapping_representation",
  1043. "inquire_colour_mapping_state",
  1044. "inquire_curve_and_surface_facilities",
  1045. "inquire_data_mapping_facilities",
  1046. "inquire_data_mapping_representation",
  1047. "inquire_depth_cue_facilities",
  1048. "inquire_depth_cue_representation",
  1049. "inquire_direct_colour_model_facilities",
  1050. "inquire_dynamics_of_workstation_attributes_plus",
  1051. "inquire_edge_representation_plus",
  1052. "inquire_interior_facilities_plus",
  1053. "inquire_interior_representation_plus",
  1054. "inquire_light_source_facilities",
  1055. "inquire_light_source_representation",
  1056. "inquire_list_of_colour_mapping_indices",
  1057. "inquire_list_of_data_mapping_indices",
  1058. "inquire_list_of_depth_cue_indices",
  1059. "inquire_list_of_light_source_indices",
  1060. "inquire_list_of_parametric_surface_indices",
  1061. "inquire_list_of_reflectance_indices",
  1062. "inquire_parametric_surface_representation",
  1063. "inquire_pattern_representation_plus",
  1064. "inquire_polyline_facilities_plus",
  1065. "inquire_polyline_representation_plus",
  1066. "inquire_polymarker_representation_plus",
  1067. "inquire_predefined_colour_mapping_representation",
  1068. "inquire_predefined_data_mapping_representation",
  1069. "inquire_predefined_depth_cue_representation",
  1070. "inquire_predefined_edge_representation_plus",
  1071. "inquire_predefined_interior_representation_plus",
  1072. "inquire_predefined_light_source_representation",
  1073. "inquire_predefined_parametric_surface_representation",
  1074. "inquire_predefined_pattern_representation_plus",
  1075. "inquire_predefined_polyline_representation_plus",
  1076. "inquire_predefined_polymarker_representation_plus",
  1077. "inquire_predefined_reflectance_representation",
  1078. "inquire_predefined_text_representation_plus",
  1079. "inquire_reflectance_facilities",
  1080. "inquire_reflectance_representation",
  1081. "inquire_rendering_colour_model_facilities",
  1082. "inquire_text_representation_plus",
  1083. "inquire_workstation_state_table_lengths_plus",
  1084. "non-uniform_b-spline_curve",
  1085. "non-uniform_b-spline_curve_with_colour",
  1086. "non-uniform_b-spline_surface",
  1087. "non-uniform_b-spline_surface_with_data",
  1088. "polyline_set3_with_data",
  1089. "quadrilateral_mesh_with_data",
  1090. "quadrilateral_mesh3_with_data",
  1091. "set_back_data_mapping_index",
  1092. "set_back_data_mapping_method",
  1093. "set_back_interior_colour",
  1094. "set_back_interior_index",
  1095. "set_back_interior_shade_method",
  1096. "set_back_interior_style",
  1097. "set_back_interior_style_index",
  1098. "set_back_reflectance_index",
  1099. "set_back_reflectance_model",
  1100. "set_back_reflectance_properties",
  1101. "set_colour_mapping_index",
  1102. "set_colour_mapping_representation",
  1103. "set_curve_approximation_criteria",
  1104. "set_data_mapping_index",
  1105. "set_data_mapping_method",
  1106. "set_data_mapping_representation",
  1107. "set_depth_cue_index",
  1108. "set_depth_cue_representation",
  1109. "set_edge_representation_plus",
  1110. "set_face_culling_mode",
  1111. "set_face_distinguishing_mode",
  1112. "set_interior_representation_plus",
  1113. "set_interior_shading_method",
  1114. "set_light_source_representation",
  1115. "set_light_source_state",
  1116. "set_of_fill_area_set_with_data",
  1117. "set_of_fill_area_set3_with_data",
  1118. "set_parametric_surface_characteristics",
  1119. "set_parametric_surface_index",
  1120. "set_parametric_surface_representation",
  1121. "set_pattern_representation_plus",
  1122. "set_polyline_representation_plus",
  1123. "set_polyline_shading_method",
  1124. "set_polymarker_representation_plus",
  1125. "set_reflectance_index",
  1126. "set_reflectance_model",
  1127. "set_reflectance_properties",
  1128. "set_reflectance_representation",
  1129. "set_rendering_colour_model",
  1130. "set_surface_approximation_criteria",
  1131. "set_text_representation_plus",
  1132. "triangle_set_with_data",
  1133. "triangle_set3_with_data",
  1134. "triangle_strip_with_data",
  1135. "triangle_strip3_with_data",
  1136. #endif
  1137. };
  1138.  
  1139. #include "enumname.c"
  1140.  
  1141. /* local variables for phinter: */
  1142. static FILE *outputscript;   /* output script file var */
  1143. static FILE *inputscript;
  1144. static FILE *informscript;
  1145. static Pint outputterm;
  1146. static Pint informterm;
  1147. static ptkboolean writingscript;  /* if TRUE, all input commands are echoed */
  1148. static ptkboolean interactive;
  1149. static ptkboolean writeinform;
  1150. static ptkboolean phinteron;
  1151. static jmp_buf EXITJMP;
  1152. static jmp_buf POPJMP;
  1153. static jmp_buf PFABORT;
  1154. static Pint lno;   /* current line number */
  1155. static Pint activefunction;
  1156. static ptkboolean fileswitch;
  1157. static Plimit phinecho;
  1158. static Pint phinws;
  1159. /* registers */
  1160. static Pmatrix3 vmm3, vom3, tm3;
  1161. static Pmatrix vmm, vom, tm;
  1162. static Pint wst;
  1163. static Pstore wststore;
  1164. static colourmodel = 1;
  1165.  
  1166. /*--------------------------------------------------------------------------*/
  1167. /*------------------------ Internal functions ------------------------------*/
  1168. /*--------------------------------------------------------------------------*/
  1169.  
  1170. static void getcolourmodel(C(Pint) wsid)
  1171. PreANSI(Pint wsid)
  1172. {
  1173.   Pint err;
  1174.  
  1175.   pinq_colr_model(wsid, &err, &colourmodel);
  1176.   if (err != 0)
  1177.     colourmodel = 1;
  1178. }  /* getcolourmodel */
  1179.  
  1180. /*--------------------------------------------------------------------------*/
  1181.  
  1182. static void printfterminal(C(Pint) windid, C(char *) format, ap)
  1183. PreANSI(Pint windid)
  1184. PreANSI(char *format)
  1185. va_list *ap;
  1186. /*
  1187. ** \parambegin
  1188. ** \param{Pint}{windid}{terminal window identifier}{IN}
  1189. ** \param{char *}{format}{format string}{IN}
  1190. ** \param{}{va\_alist}{variable length argument list}{IN}
  1191. ** \paramend
  1192. ** \blurb{Does the same as writeterminal except any following
  1193. ** strings will be displayed on a new line.}
  1194. */
  1195. {
  1196.   char str[255], line[255];
  1197.   char *newline, *firstchar;
  1198.  
  1199.   vsprintf(str, format, *ap);
  1200.   firstchar = &str[0];
  1201.   while ((newline = strchr(firstchar, '\n')) != NULL)
  1202.   {
  1203.     strncpy(line, firstchar, (newline - firstchar)); 
  1204.     line[newline - firstchar] = '\0';
  1205.     ptk_writelnterminal(windid, line);
  1206.     firstchar = newline + 1;
  1207.   }
  1208.  
  1209.   if (firstchar != '\0')
  1210.     ptk_writeterminal(windid, firstchar);
  1211. }  /* printfterminal */
  1212.  
  1213. /*--------------------------------------------------------------------------*/
  1214.  
  1215. static void phinprintf(C(ptkedest) dest, C(char *) format, va_alist)
  1216. PreANSI(ptkedest dest)
  1217. PreANSI(char *format)
  1218. va_dcl
  1219. /*
  1220. */
  1221. {
  1222.   va_list args;
  1223.   char str[255], line[255];
  1224.   char *newline, *firstchar;
  1225.  
  1226.   va_start(args); 
  1227.   if (fileswitch)
  1228.   {
  1229.     switch (dest)
  1230.     {
  1231.       case PTKEOUTPUT: vfprintf(outputscript, format, args);
  1232.         break;
  1233.     
  1234.       case PTKEINFORM: vfprintf(informscript, format, args);
  1235.         break;
  1236.  
  1237.       case PTKESTDOUT: vfprintf(stdout, format, args);
  1238.         break;
  1239.     }
  1240.   }
  1241.   else
  1242.   {
  1243.     switch (dest)
  1244.     {
  1245.       case PTKEOUTPUT: printfterminal(outputterm, format, &args);
  1246.         break;
  1247.     
  1248.       case PTKESTDOUT: 
  1249.         if (writeinform)
  1250.           printfterminal(informterm, format, &args);
  1251.         break;
  1252.  
  1253.       case PTKEINFORM: printfterminal(informterm, format, &args);
  1254.         break;
  1255.     }
  1256.   }
  1257.   va_end(args);
  1258. }  /* phinprintf */
  1259.  
  1260. /*--------------------------------------------------------------------------*/
  1261.  
  1262. static void phigserror(C(ptkedest) dest, C(Pint) error)
  1263. PreANSI(ptkedest dest)
  1264. PreANSI(Pint error)
  1265. {
  1266.   phinprintf(dest, "error with %s = %d.\n", phigsnamelist[activefunction], 
  1267.           error);
  1268. }
  1269.  
  1270. /*--------------------------------------------------------------------------*/
  1271.  
  1272. static void phintererror(C(Pint) c, C(char *) s, C(ptkeseverity) severity)
  1273. PreANSI(Pint c)
  1274. PreANSI(char *s)
  1275. PreANSI(ptkeseverity severity)
  1276. /*
  1277. ** description: writes out a message, and exits if severity=EXITERR. 
  1278. ** input params: 
  1279. ** output params: 
  1280. ** return value: 
  1281. */
  1282. {
  1283.   switch (c) 
  1284.   {
  1285. #ifdef SUN
  1286.     case 1: fprintf(stderr, "Phinter: function not yet supported in SunPHIGS.\n");
  1287.             break;
  1288. #endif
  1289. #ifdef VMS
  1290.     case 1: fprintf(stderr, "Phinter: function not yet supported in DEC PHIGS.\n");
  1291.             break;
  1292. #endif
  1293. #ifdef HP
  1294.     case 1: fprintf(stderr, "function not yet supported in HP PHIGS.\n");
  1295.             break;
  1296. #endif
  1297. #ifdef PEXSI
  1298.     case 1: fprintf(stderr, "function not yet supported in PEX-SI PHIGS.\n");
  1299.             break;
  1300. #endif
  1301.     case 2: fprintf(stderr, "%s", s);
  1302.             break;
  1303.  
  1304.     case 3: fprintf(stderr, "function not yet supported in phinter.\n");
  1305.             break;
  1306.   }
  1307.   if (severity == POPREQ)
  1308.   {
  1309.     longjmp(POPJMP, 1);
  1310.     return;
  1311.   }
  1312.   if (severity == EXITERR) 
  1313.     longjmp(EXITJMP, 1);
  1314. }  /* phintererror */
  1315.  
  1316. /*--------------------------------------------------------------------------*/
  1317.  
  1318. static void set_i_prompt(C(char *) s)
  1319. PreANSI(char *s)
  1320. /*
  1321. ** description: only set prompt for an interactive device.
  1322. ** input params: s - prompt. 
  1323. ** output params: none.
  1324. ** return value: none.
  1325. */
  1326. {
  1327.   if (interactive)
  1328.     printf("%s> ", s);
  1329. }  /* set_i_prompt */
  1330.  
  1331. /*--------------------------------------------------------------------------*/
  1332. /*-------------------- general writing functions ---------------------------*/
  1333. /*--------------------------------------------------------------------------*/
  1334.  
  1335. static void writephigsenum(C(ptkedest) dest, C(ptkephigsenum) enumtype,
  1336.                            C(Pint) enumval)
  1337. PreANSI(ptkedest dest)
  1338. PreANSI(ptkephigsenum enumtype)
  1339. PreANSI(Pint enumval)
  1340. {
  1341.   switch (enumtype)
  1342.   {
  1343.     case PTKEWSDEP:
  1344.      phinprintf(dest, "%s\n", Pws_dep_indnames[enumval]);
  1345.      break;
  1346.  
  1347.     case PTKESYSTEMSTATE:
  1348.      phinprintf(dest, "%s\n", Psys_stnames[enumval]);
  1349.      break;
  1350.  
  1351.     case PTKEWSSTATE:
  1352.      phinprintf(dest, "%s\n", Pws_stnames[enumval]);
  1353.      break;
  1354.  
  1355.     case PTKESTRUCTSTATE:
  1356.      phinprintf(dest, "%s\n", Pstruct_stnames[enumval]);
  1357.      break;
  1358.  
  1359.     case PTKESTRUCTSTATUS:
  1360.      phinprintf(dest, "%s\n", Pstruct_statusnames[enumval]);
  1361.      break;
  1362.  
  1363.     case PTKEARCHIVESTATE:
  1364.      phinprintf(dest, "%s\n", Par_stnames[enumval]);
  1365.      break;
  1366.  
  1367.     case PTKEWSCLASS:
  1368.      phinprintf(dest, "%s\n", Pws_classnames[enumval]);
  1369.      break;
  1370.  
  1371.     case PTKEWSCAT:
  1372.      phinprintf(dest, "%s\n", Pws_catnames[enumval]);
  1373.      break;
  1374.  
  1375.     case PTKECONTROL:
  1376.      phinprintf(dest, "%s\n", Pctrl_flagnames[enumval]);
  1377.      break;
  1378.  
  1379.     case PTKEREGEN:
  1380.      phinprintf(dest, "%s\n", Pregen_flagnames[enumval]);
  1381.      break;
  1382.  
  1383.     case PTKEDEFMODE:
  1384.      phinprintf(dest, "%s\n", Pdefer_modenames[enumval]);
  1385.      break;
  1386.  
  1387.     case PTKEMOD:
  1388.      phinprintf(dest, "%s\n", Pmodnames[enumval]);
  1389.      break;
  1390.  
  1391.     case PTKESIMULTEV:
  1392.      phinprintf(dest, "%s\n", Psimult_eventsnames[enumval]);
  1393.      break;
  1394.  
  1395.     case PTKESTRUCTNETSRC:
  1396.      phinprintf(dest, "%s\n", Pstruct_net_sourcenames[enumval]);
  1397.      break;
  1398.  
  1399.     case PTKEDSPSURF:
  1400.      phinprintf(dest, "%s\n", Pdisp_surfnames[enumval]);
  1401.      break;
  1402.  
  1403.     case PTKEVISUALREP:
  1404.      phinprintf(dest, "%s\n", Pvisual_stnames[enumval]);
  1405.      break;
  1406.  
  1407.     case PTKETXPREC:
  1408.      phinprintf(dest, "%s\n", Ptext_precnames[enumval]);
  1409.      break;
  1410.  
  1411.     case PTKETXPATH:
  1412.      phinprintf(dest, "%s\n", Ptext_pathnames[enumval]);
  1413.      break;
  1414.  
  1415.     case PTKETXHOR:
  1416.      phinprintf(dest, "%s\n", Phor_alignnames[enumval]);
  1417.      break;
  1418.  
  1419.     case PTKETXVER:
  1420.      phinprintf(dest, "%s\n", Pvert_alignnames[enumval]);
  1421.      break;
  1422.  
  1423.     case PTKEINTERSTYLE:
  1424.      phinprintf(dest, "%s\n", Pint_stylenames[enumval]);
  1425.      break;
  1426.  
  1427.     case PTKEEDGEF:
  1428.      phinprintf(dest, "%s\n", Pedge_flagnames[enumval]);
  1429.      break;
  1430.  
  1431.     case PTKEATTRID:
  1432.      phinprintf(dest, "%s\n", Paspectnames[enumval]);
  1433.      break;
  1434.  
  1435.     case PTKEASF:
  1436.      phinprintf(dest, "%s\n", Pasfnames[enumval]);
  1437.      break;
  1438.  
  1439.     case PTKECOAVAIL:
  1440.      phinprintf(dest, "%s\n", Pcolr_availnames[enumval]);
  1441.      break;
  1442.  
  1443.     case PTKECOMPTYPE:
  1444.      phinprintf(dest, "%s\n", Pcompose_typenames[enumval]);
  1445.      break;
  1446.  
  1447.     case PTKEPROJTYPE:
  1448.      phinprintf(dest, "%s\n", Pproj_typenames[enumval]);
  1449.      break;
  1450.  
  1451.     case PTKECLIP:
  1452.      phinprintf(dest, "%s\n", Pclip_indnames[enumval]);
  1453.      break;
  1454.  
  1455.     case PTKEVPRI:
  1456.      phinprintf(dest, "%s\n", Pprinames[enumval]);
  1457.      break;
  1458.  
  1459.     case PTKECONFRES:
  1460.      phinprintf(dest, "%s\n", Pconf_resnames[enumval]);
  1461.      break;
  1462.  
  1463.     case PTKEPFCF:
  1464.      phinprintf(dest, "%s\n", Ppfcfnames[enumval]);
  1465.      break;
  1466.  
  1467.     case PTKEPATHORDER:
  1468.      phinprintf(dest, "%s\n", Ppath_ordernames[enumval]);
  1469.      break;
  1470.  
  1471.     case PTKEIMODE:
  1472.      phinprintf(dest, "%s\n", Pop_modenames[enumval]);
  1473.      break;
  1474.  
  1475.     case PTKEESW:
  1476.      phinprintf(dest, "%s\n", Pechonames[enumval]);
  1477.      break;
  1478.  
  1479.     case PTKEISTATUS:
  1480.      phinprintf(dest, "%s\n", Pistatusnames[enumval]);
  1481.      break;
  1482.  
  1483.     case PTKEOPENSTRUCTSTATUS:
  1484.      phinprintf(dest, "%s\n", Popen_struct_statusnames[enumval]);
  1485.      break;
  1486.  
  1487.     case PTKEICLASS:
  1488.      phinprintf(dest, "%s\n", Pin_classnames[enumval]);
  1489.      break;
  1490.  
  1491.     case PTKEPRF:
  1492.      phinprintf(dest, "%s\n", Pprompt_switchnames[enumval]);
  1493.      break;
  1494.  
  1495.     case PTKEINQTYPE:
  1496.      phinprintf(dest, "%s\n", Pinq_typenames[enumval]);
  1497.      break;
  1498.  
  1499.     case PTKEUPDATEST:
  1500.      phinprintf(dest, "%s\n", Pupd_stnames[enumval]);
  1501.      break;
  1502.  
  1503.     case PTKEDEVUNITS:
  1504.      phinprintf(dest, "%s\n", Pdc_unitsnames[enumval]);
  1505.      break;
  1506.  
  1507.     case PTKEMODTYPE:
  1508.      phinprintf(dest, "%s\n", Pdyn_modnames[enumval]);
  1509.      break;
  1510.  
  1511.     case PTKEATTRS:
  1512.      phinprintf(dest, "%s\n", Pattrsnames[enumval]);
  1513.      break;
  1514.  
  1515.     case PTKEELTYPE:
  1516.      phinprintf(dest, "%s\n", Pelem_typenames[enumval]);
  1517.      break;
  1518.  
  1519.     case PTKEEDITMODE:
  1520.      phinprintf(dest, "%s\n", Pedit_modenames[enumval]);
  1521.      break;
  1522.  
  1523.     case PTKEREFF:
  1524.      phinprintf(dest, "%s\n", Pref_flagnames[enumval]);
  1525.      break;
  1526.  
  1527.     case PTKEERRORMODE:
  1528.      phinprintf(dest, "%s\n", Perr_modenames[enumval]);
  1529.      break;
  1530.  
  1531.     case PTKESRCHDIR:
  1532.      phinprintf(dest, "%s\n", Psearch_dirnames[enumval]);
  1533.      break;
  1534.  
  1535.     case PTKESRCHSTATUS:
  1536.      phinprintf(dest, "%s\n", Psearch_statusnames[enumval]);
  1537.      break;
  1538.  
  1539.     case PTKESRCHELTYPE:
  1540.      phinprintf(dest, "%s\n", Pelem_typenames[enumval]);
  1541.      break;
  1542.  
  1543. #ifdef SUN
  1544.     case PTKEBASENAME:
  1545.      phinprintf(dest, "%s\n", Pbasenames[enumval]);
  1546.      break;
  1547.  
  1548.     case PTKEWSTYPEATTR:
  1549.      phinprintf(dest, "%s\n", Pwsattrnames[enumval]);
  1550.      break;
  1551.  
  1552.     case PTKEDBLBUFF:
  1553.      phinprintf(dest, "%s\n", Pdblbuffnames[enumval]);
  1554.      break;
  1555.  
  1556.     case PTKEACCUSAGE:
  1557.      phinprintf(dest, "%s\n", Paccusagenames[enumval]);
  1558.      break;
  1559.  
  1560.     case PTKECURSORTYPE:
  1561.      phinprintf(dest, "%s\n", Pcursortypenames[enumval]);
  1562.      break;
  1563.  
  1564.     case PTKECOLOURMODE:
  1565.      phinprintf(dest, "%s\n", Pcolourmodenames[enumval]);
  1566.      break;
  1567.  
  1568.     case PTKECGMENCODING:
  1569.      phinprintf(dest, "%s\n", Pcgmencodingnames[enumval]);
  1570.      break;
  1571.  
  1572.     case PTKECGMCONFORMANCE:
  1573.      phinprintf(dest, "%s\n", Pcgmconformancenames[enumval]);
  1574.      break;
  1575.  
  1576.     case PTKECGMVDCPRECISION:
  1577.      phinprintf(dest, "%s\n", Pcgmvdcprecisionnames[enumval]);
  1578.      break;
  1579.  
  1580.     case PTKEBGCLEAR:
  1581.      phinprintf(dest, "%s\n", Pbgclearnames[enumval]);
  1582.      break;
  1583.  
  1584.     case PTKEUSEDECOMP:
  1585.      phinprintf(dest, "%s\n", Pdcmpnames[enumval]);
  1586.      break;
  1587.  
  1588.     case PTKEDCMODEL:
  1589.      phinprintf(dest, "%s\n", Pdcmodelnames[enumval]);
  1590.      break;
  1591.  
  1592.     case PTKESIMULATEPICK:
  1593.      phinprintf(dest, "%s\n", Psimulatepicknames[enumval]);
  1594.      break;
  1595. #endif
  1596.  
  1597. /* PHIGS PLUS bits */
  1598. #ifdef SUN
  1599.     case PTKEDCUEMODE:
  1600.      phinprintf(dest, "%s\n", Pdcuemodenames[enumval]);
  1601.      break;
  1602.  
  1603.     case PTKERATIONAL:
  1604.      phinprintf(dest, "%s\n", Prationalnames[enumval]);
  1605.      break;
  1606.  
  1607.     case PTKECULLMODE:
  1608.      phinprintf(dest, "%s\n", Pcullmodenames[enumval]);
  1609.      break;
  1610.  
  1611.     case PTKEDISTINGMODE:
  1612.      phinprintf(dest, "%s\n", Pdistingmodenames[enumval]);
  1613.      break;
  1614.  
  1615.     case PTKECURVEPLACE:
  1616.      phinprintf(dest, "%s\n", Pcurveplacenames[enumval]);
  1617.      break;
  1618. #endif
  1619.    }
  1620. }
  1621.  
  1622. /*--------------------------------------------------------------------------*/
  1623.  
  1624. static void writeenumlist(C(ptkedest) dest, C(ptkephigsenum) enumtype,
  1625.                           C(Pint) length, C(Pint *) enumlist)
  1626. PreANSI(ptkedest dest)
  1627. PreANSI(ptkephigsenum enumtype)
  1628. PreANSI(Pint length)
  1629. PreANSI(Pint *enumlist)
  1630. {
  1631.   Pint i;
  1632.  
  1633.   for (i = 0; i < length; i++)
  1634.     writephigsenum(dest, enumtype, enumlist[i]);
  1635. }
  1636.  
  1637. /*--------------------------------------------------------------------------*/
  1638.  
  1639. static void writeinteger(C(ptkedest) dest, C(Pint) value)
  1640. PreANSI(ptkedest dest)
  1641. PreANSI(Pint value)
  1642. {
  1643.   phinprintf(dest, "%d\n", value);
  1644. }
  1645.  
  1646. /*--------------------------------------------------------------------------*/
  1647.  
  1648. static void writeintvalue(C(ptkedest) dest, C(Pint) value,
  1649.                           C(ptkehashtable) htable)
  1650. PreANSI(ptkedest dest)
  1651. PreANSI(Pint value)
  1652. PreANSI(ptkehashtable htable)
  1653. /*
  1654. ** description: 
  1655. ** input params: 
  1656. ** output params: 
  1657. ** return value: 
  1658. */
  1659. {
  1660.   char tablename[20], str[100];
  1661.   Pint size;
  1662.  
  1663.   switch (htable)
  1664.   {
  1665.     case PTKESTRUCTID:
  1666.       strcpy(tablename, "structureid");
  1667.       break;    
  1668.  
  1669.     case PTKELABELVAL:
  1670.       strcpy(tablename, "label");
  1671.       break;    
  1672.  
  1673.     case PTKEPICKID:
  1674.       strcpy(tablename, "pickid");
  1675.       break;    
  1676.  
  1677.     case PTKEVIEWIND:
  1678.       strcpy(tablename, "viewindex");
  1679.       break;    
  1680.  
  1681.     case PTKECOLOURIND:
  1682.       strcpy(tablename, "colourindex");
  1683.       break;    
  1684.  
  1685.     case PTKENAME:
  1686.       strcpy(tablename, "name");
  1687.       break;    
  1688.   }
  1689.   if (ptk_hashtableused(tablename))
  1690.   {
  1691.     ptk_inttostring(tablename, value, 100, str, &size);
  1692.     if (size > 0)
  1693.       phinprintf(dest,"\"%s\"\n", str);
  1694.     else
  1695.       writeinteger(dest, value);
  1696.   }
  1697.   else
  1698.   {
  1699.     writeinteger(dest, value);
  1700.   }
  1701. }  /* writeintvalue */
  1702.  
  1703. /*--------------------------------------------------------------------------*/
  1704.  
  1705. static void writereal(C(ptkedest) dest, C(Pfloat) value)
  1706. PreANSI(ptkedest dest)
  1707. PreANSI(Pfloat value)
  1708. {
  1709.   phinprintf(dest, "%f\n", value);
  1710. }
  1711.  
  1712. /*--------------------------------------------------------------------------*/
  1713.  
  1714. static void writepoint(C(ptkedest) dest, C(Ppoint *) pt)
  1715. PreANSI(ptkedest dest)
  1716. PreANSI(Ppoint *pt)
  1717. {
  1718.   phinprintf(dest, "%f %f\n", pt->x, pt->y);
  1719. }
  1720.  
  1721. /*--------------------------------------------------------------------------*/
  1722.  
  1723. static void writevector(C(ptkedest) dest, C(Pvec *) vec)
  1724. PreANSI(ptkedest dest)
  1725. PreANSI(Pvec *vec)
  1726. {
  1727.   phinprintf(dest, "%f %f\n", vec->delta_x, vec->delta_y);
  1728. }
  1729.  
  1730. /*--------------------------------------------------------------------------*/
  1731.  
  1732. static void writefloatsize(C(ptkedest) dest, C(Pfloat_size *) fs)
  1733. PreANSI(ptkedest dest)
  1734. PreANSI(Pfloat_size *fs)
  1735. {
  1736.   phinprintf(dest, "%f %f\n", fs->size_x, fs->size_y);
  1737. }
  1738.  
  1739. /*--------------------------------------------------------------------------*/
  1740.  
  1741. static void writeintsize(C(ptkedest) dest, C(Pint_size *) is)
  1742. PreANSI(ptkedest dest)
  1743. PreANSI(Pint_size *is)
  1744. {
  1745.   phinprintf(dest, "%d %d\n", is->size_x, is->size_y);
  1746. }
  1747.  
  1748. /*--------------------------------------------------------------------------*/
  1749.  
  1750. static void writepoint3(C(ptkedest) dest, C(Ppoint3 *) pt)
  1751. PreANSI(ptkedest dest)
  1752. PreANSI(Ppoint3 *pt)
  1753. {
  1754.   phinprintf(dest, "%f %f %f\n", pt->x, pt->y, pt->z);
  1755. }
  1756.  
  1757. /*--------------------------------------------------------------------------*/
  1758.  
  1759. static void writevector3(C(ptkedest) dest, C(Pvec3 *) vec)
  1760. PreANSI(ptkedest dest)
  1761. PreANSI(Pvec3 *vec)
  1762. {
  1763.   phinprintf(dest, "%f %f %f\n", vec->delta_x, vec->delta_y, vec->delta_z);
  1764. }
  1765.  
  1766. /*--------------------------------------------------------------------------*/
  1767.  
  1768. static void writefloatsize3(C(ptkedest) dest, C(Pfloat_size3 *) sz)
  1769. PreANSI(ptkedest dest)
  1770. PreANSI(Pfloat_size3 *sz)
  1771. {
  1772.   phinprintf(dest, "%f %f %f\n", sz->size_x, sz->size_y, sz->size_z);
  1773. }
  1774.  
  1775. /*--------------------------------------------------------------------------*/
  1776.  
  1777. static void writeintsize3(C(ptkedest) dest, C(Pint_size3 *) sz)
  1778. PreANSI(ptkedest dest)
  1779. PreANSI(Pint_size3 *sz)
  1780. {
  1781.   phinprintf(dest, "%d %d %d\n", sz->size_x, sz->size_y, sz->size_z);
  1782. }
  1783.  
  1784. /*--------------------------------------------------------------------------*/
  1785.  
  1786. static void writecobundl(C(ptkedest) dest, C(Pcolr_rep *) colour)
  1787. PreANSI(ptkedest dest)
  1788. PreANSI(Pcolr_rep *colour)
  1789. {
  1790.   switch (colourmodel)
  1791.   {
  1792.     case PMODEL_RGB: 
  1793.       phinprintf(dest, "%f %f %f\n", colour->rgb.red, colour->rgb.green,
  1794.                  colour->rgb.blue);
  1795.       break;
  1796.  
  1797.     case PMODEL_CIELUV: 
  1798.       phinprintf(dest, "%f %f %f\n", colour->cieluv.cieluv_x,
  1799.                  colour->cieluv.cieluv_y, colour->cieluv.cieluv_y_lum);
  1800.       break;
  1801.  
  1802.     case PMODEL_HSV: 
  1803.       phinprintf(dest, "%f %f %f\n", colour->hsv.hue,
  1804.                  colour->hsv.satur, colour->hsv.value);
  1805.       break;
  1806.  
  1807.     case PMODEL_HLS: 
  1808.       phinprintf(dest, "%f %f %f\n", colour->hls.hue, 
  1809.                  colour->hls.lightness, colour->hls.satur);
  1810.       break;
  1811.   }
  1812. }
  1813.  
  1814. /*--------------------------------------------------------------------------*/
  1815.  
  1816. /* PHIGS PLUS bits */
  1817. #ifdef SUN
  1818. static void writecolreplist(C(ptkedest) dest, C(Pcolr_rep_list *) colours)
  1819. PreANSI(ptkedest dest)
  1820. PreANSI(Pcolr_rep_list *colours)
  1821. {
  1822.   Pint i;
  1823.  
  1824.   writeinteger(dest, colours->num_colr_reps);
  1825.   for (i = 0; i < colours->num_colr_reps; i++)
  1826.     writecobundl(dest, &colours->colr_reps[i]);
  1827. }
  1828. #endif
  1829.  
  1830. /*--------------------------------------------------------------------------*/
  1831.  
  1832. static void writelimit(C(ptkedest) dest, C(Plimit *) lt)
  1833. PreANSI(ptkedest dest)
  1834. PreANSI(Plimit *lt)
  1835. {
  1836.   phinprintf(dest, "%f %f\n", lt->x_min, lt->x_max);
  1837.   phinprintf(dest, "%f %f\n", lt->y_min, lt->y_max);
  1838. }
  1839.  
  1840. /*--------------------------------------------------------------------------*/
  1841.  
  1842. static void writelimit3(C(ptkedest) dest, C(Plimit3 *) lt)
  1843. PreANSI(ptkedest dest)
  1844. PreANSI(Plimit3 *lt)
  1845. {
  1846.   phinprintf(dest, "%f %f\n", lt->x_min, lt->x_max);
  1847.   phinprintf(dest, "%f %f\n", lt->y_min, lt->y_max);
  1848.   phinprintf(dest, "%f %f\n", lt->z_min, lt->z_max);
  1849. }
  1850.  
  1851. /*--------------------------------------------------------------------------*/
  1852.  
  1853. static void writematrix(C(ptkedest) dest, C(Pmatrix) mat)
  1854. PreANSI(ptkedest dest)
  1855. PreANSI(Pmatrix mat)
  1856. {
  1857.   Pint i;
  1858.  
  1859.   for (i = 0; i < 3; i++)
  1860.      phinprintf(dest, "%f %f %f\n", mat[i][0], mat[i][1], mat[i][2]);
  1861. }
  1862.  
  1863. /*--------------------------------------------------------------------------*/
  1864.  
  1865. static void writematrix3(C(ptkedest) dest, C(Pmatrix3) mat)
  1866. PreANSI(ptkedest dest)
  1867. PreANSI(Pmatrix3 mat)
  1868. {
  1869.   Pint i;
  1870.  
  1871.   for (i = 0; i <= 3; i++)
  1872.     phinprintf(dest, "%f %f %f %f\n", mat[i][0], mat[i][1], mat[i][2], 
  1873.             mat[i][3]);
  1874. }
  1875.  
  1876. /*--------------------------------------------------------------------------*/
  1877.  
  1878. static void writeintlst(C(ptkedest) dest, C(Pint_list *) intlist, 
  1879.                         C(ptkehashtable) htable)
  1880. PreANSI(ptkedest dest)
  1881. PreANSI(Pint_list *intlist)
  1882. PreANSI(ptkehashtable htable)
  1883. {
  1884.   Pint i;
  1885.  
  1886.   writeinteger(dest, intlist->num_ints);
  1887.   for (i = 0; i < intlist->num_ints; i++)
  1888.   {
  1889.     writeintvalue(dest, intlist->ints[i], htable);
  1890.   }
  1891. }
  1892.  
  1893. /*--------------------------------------------------------------------------*/
  1894.  
  1895. static void writefloatlist(C(ptkedest) dest, C(Pfloat_list *) flist)
  1896. PreANSI(ptkedest dest)
  1897. PreANSI(Pfloat_list *flist)
  1898. {
  1899.   Pint i;
  1900.  
  1901.   writeinteger(dest, flist->num_floats);
  1902.   for (i = 0; i < flist->num_floats; i++)
  1903.   {
  1904.     writereal(dest, flist->floats[i]);
  1905.   }
  1906. }
  1907.  
  1908. /*--------------------------------------------------------------------------*/
  1909.  
  1910. static void writepointlst3(C(ptkedest) dest, C(Ppoint_list3 *) ptlist)
  1911. PreANSI(ptkedest dest)
  1912. PreANSI(Ppoint_list3 *ptlist)
  1913. {
  1914.   Pint i;
  1915.  
  1916.   writeinteger(dest, ptlist->num_points);
  1917.   for (i = 0; i < ptlist->num_points; i++)
  1918.   {
  1919.     writepoint3(dest, &ptlist->points[i]);
  1920.   }
  1921. }
  1922.  
  1923. /*--------------------------------------------------------------------------*/
  1924.  
  1925. static void writepointlst(C(ptkedest) dest, C(Ppoint_list *) ptlist)
  1926. PreANSI(ptkedest dest)
  1927. PreANSI(Ppoint_list *ptlist)
  1928. {
  1929.   Pint i;
  1930.  
  1931.   writeinteger(dest, ptlist->num_points);
  1932.   for (i = 0; i < ptlist->num_points; i++)
  1933.   {
  1934.     writepoint(dest, &ptlist->points[i]);
  1935.   }
  1936. }
  1937.  
  1938. /*--------------------------------------------------------------------------*/
  1939.  
  1940. static void writeintarray(C(ptkedest) dest, C(Pint) num, C(Pint *) ints,
  1941.                           C(ptkehashtable) htable)
  1942. PreANSI(ptkedest dest)
  1943. PreANSI(Pint num)
  1944. PreANSI(Pint *ints)
  1945. PreANSI(ptkehashtable htable)
  1946. {
  1947.   Pint i;
  1948.  
  1949.   for (i = 0; i < num; i++)
  1950.   {
  1951.     writeintvalue(dest, ints[i], htable);
  1952.   }
  1953. }
  1954.  
  1955. /*--------------------------------------------------------------------------*/
  1956.  
  1957. static void writepointarray(C(ptkedest) dest, C(Pint) numpts, 
  1958.                             C(Ppoint *) pts)
  1959. PreANSI(ptkedest dest)
  1960. PreANSI(Pint numpts)
  1961. PreANSI(Ppoint *pts)
  1962. {
  1963.   Pint i;
  1964.  
  1965.   for (i = 0; i < numpts; i++)
  1966.   {
  1967.     writepoint(dest, &pts[i]);
  1968.   }
  1969. }
  1970.  
  1971. /*--------------------------------------------------------------------------*/
  1972.  
  1973. static void writepointarray3(C(ptkedest) dest, C(Pint) numpts, 
  1974.                              C(Ppoint3 *) pts)
  1975. PreANSI(ptkedest dest)
  1976. PreANSI(Pint numpts)
  1977. PreANSI(Ppoint3 *pts)
  1978. {
  1979.   Pint i;
  1980.  
  1981.   for (i = 0; i < numpts; i++)
  1982.   {
  1983.     writepoint3(dest, &pts[i]);
  1984.   }
  1985. }
  1986.  
  1987. /*--------------------------------------------------------------------------*/
  1988.  
  1989. static void writepickpath(C(ptkedest) dest, C(Ppick_path *) path)
  1990. PreANSI(ptkedest dest)
  1991. PreANSI(Ppick_path *path)
  1992. {
  1993.   Pint i;
  1994.  
  1995.   phinprintf(dest, "depth = %d\n", path->depth);
  1996.   for (i = 0; i < path->depth; i++)
  1997.   {
  1998.     phinprintf(dest, "structure identifier [%d] = %d\n", i,
  1999.                path->path_list[i].struct_id);
  2000.     phinprintf(dest, "pick identifier [%d] = %d\n", i,
  2001.                path->path_list[i].pick_id);
  2002.     phinprintf(dest, "element [%d] = %d\n", i, 
  2003.                path->path_list[i].elem_pos);
  2004.   }
  2005. }
  2006.  
  2007. /*--------------------------------------------------------------------------*/
  2008.  
  2009. /*--------------------------------------------------------------------------*/
  2010. /*------------------- PHIGS PLUS write functions ---------------------------*/
  2011. /*--------------------------------------------------------------------------*/
  2012.  
  2013. #ifdef SUN
  2014.  
  2015. static void writeintlistlist(C(ptkedest) dest, C(Pint_list_list *) lists, 
  2016.                         C(ptkehashtable) htable)
  2017. PreANSI(ptkedest dest)
  2018. PreANSI(Pint_list_list *lists)
  2019. PreANSI(ptkehashtable htable)
  2020. {
  2021.   Pint i;
  2022.  
  2023.   writeinteger(dest, lists->num_lists);
  2024.   for (i = 0; i < lists->num_lists; i++)
  2025.   {
  2026.     writeintlst(dest, lists->lists[i], htable);
  2027.   }
  2028. }  /* writeintlistlist */
  2029.  
  2030. /*--------------------------------------------------------------------------*/
  2031.  
  2032. static void writepoint4(C(ptkedest) dest, C(Ppoint4 *) pt)
  2033. PreANSI(ptkedest dest)
  2034. PreANSI(Ppoint4 *pt)
  2035. {
  2036.   phinprintf(dest, "%f %f %f %f\n", pt->x, pt->y, pt->z, pt->w);
  2037. }  /* writepoint4 */
  2038.  
  2039. /*--------------------------------------------------------------------------*/
  2040.  
  2041. static void writegcolr(C(ptkedest) dest, C(Pgcolr *) colour)
  2042. PreANSI(ptkedest dest)
  2043. PreANSI(Pgcolr *colour)
  2044. {
  2045.   writeinteger(dest, colour->type);
  2046.   if (colour->type == PINDIRECT)
  2047.     writeintvalue(dest, colour->val.ind, PTKECOLOURIND);
  2048.   else
  2049.     phinprintf(dest, "%f %f %f\n", colour->val.general.x,
  2050.                colour->val.general.y, colour->val.general.z); 
  2051. }  /* writegcolr */
  2052.  
  2053. /*--------------------------------------------------------------------------*/
  2054.  
  2055. static void writedirectcolour(C(ptkedest) dest, C(Pint) colourmod,
  2056.                         C(Pcolr_rep *) colour)
  2057. PreANSI(ptkedest dest)
  2058. PreANSI(Pint colourmod)
  2059. PreANSI(Pcolr_rep *colour)
  2060. {
  2061.   switch (colourmod)
  2062.   {
  2063.     case PMODEL_RGB: 
  2064.       phinprintf(dest, "%f %f %f\n", colour->rgb.red, colour->rgb.green,
  2065.                  colour->rgb.blue);
  2066.       break;
  2067.  
  2068.     case PMODEL_CIELUV: 
  2069.       phinprintf(dest, "%f %f %f\n", colour->cieluv.cieluv_x,
  2070.                  colour->cieluv.cieluv_y, colour->cieluv.cieluv_y_lum);
  2071.       break;
  2072.  
  2073.     case PMODEL_HSV: 
  2074.       phinprintf(dest, "%f %f %f\n", colour->hsv.hue,
  2075.                  colour->hsv.satur, colour->hsv.value);
  2076.       break;
  2077.  
  2078.     case PMODEL_HLS: 
  2079.       phinprintf(dest, "%f %f %f\n", colour->hls.hue, 
  2080.                  colour->hls.lightness, colour->hls.satur);
  2081.       break;
  2082.   }
  2083. }  /* writedirectcolour */
  2084.  
  2085. /*--------------------------------------------------------------------------*/
  2086.  
  2087. static void writereflprops(C(ptkedest) dest, C(Prefl_props *) props)
  2088. PreANSI(ptkedest dest)
  2089. PreANSI(Prefl_props *props)
  2090. {
  2091.   phinprintf(dest, "%f\n", props->ambient_coef);
  2092.   phinprintf(dest, "%f\n", props->diffuse_coef);
  2093.   phinprintf(dest, "%f\n", props->specular_coef);
  2094.   writegcolr(dest, &props->specular_colr);
  2095.   phinprintf(dest, "%f\n", props->specular_exp);
  2096.   phinprintf(dest, "%f\n", props->transpar_coef);
  2097. }  /* writereflprops */
  2098.  
  2099. /*--------------------------------------------------------------------------*/
  2100.  
  2101. static void writeparal(C(ptkedest) dest, C(Pparal *) paral)
  2102. PreANSI(ptkedest dest)
  2103. PreANSI(Pparal *paral)
  2104. {
  2105.   writepoint3(dest, ¶l->p);
  2106.   writepoint3(dest, ¶l->q);
  2107.   writepoint3(dest, ¶l->r);
  2108. }  /* writeparal */
  2109.  
  2110. /*--------------------------------------------------------------------------*/
  2111.  
  2112. static void writeedgebundleplus(C(ptkedest) dest, 
  2113.                                 C(Pedge_bundle_plus *) bundl)
  2114. PreANSI(ptkedest dest)
  2115. PreANSI(Pedge_bundle_plus *bundl)
  2116. {
  2117.   phinprintf(dest, "edge flag = ");
  2118.   writephigsenum(dest, PTKEEDGEF, bundl->flag);
  2119.   phinprintf(dest, "edge type = ");
  2120.   writeinteger(dest, bundl->type);
  2121.   phinprintf(dest, "edgewidth scale factor = ");
  2122.   writereal(dest, bundl->width);
  2123.   phinprintf(dest, "edge colour:\n");
  2124.   phinprintf(dest, "colour type = ");
  2125.   writegcolr(dest, &bundl->colr);
  2126. }  /* writedgebundleplus */
  2127.  
  2128. /*--------------------------------------------------------------------------*/
  2129.  
  2130. static void writeinterbundleplus(C(ptkedest) dest, 
  2131.                                  C(Pint_bundle_plus *) bundl)
  2132. PreANSI(ptkedest dest)
  2133. PreANSI(Pint_bundle_plus *bundl)
  2134. {
  2135.   phinprintf(dest, "interior style = ");
  2136.   writephigsenum(dest, PTKEINTERSTYLE, bundl->style);
  2137.   phinprintf(dest, "interior style index = ");
  2138.   writeinteger(dest, bundl->style_ind);
  2139.   phinprintf(dest, "interior colour:\n");
  2140.   phinprintf(dest, "colour type = ");
  2141.   writegcolr(dest, &bundl->colr);
  2142.   phinprintf(dest, "reflectance model = %d\n", bundl->refl_eqn);
  2143.   phinprintf(dest, "shading method = %d\n", bundl->shad_meth);
  2144.   phinprintf(dest, "reflectance properties:\n");
  2145.   writereflprops(dest, &bundl->refl_props);
  2146.   phinprintf(dest, "back interior style = ");
  2147.   writephigsenum(dest, PTKEINTERSTYLE, bundl->back_style);
  2148.   phinprintf(dest, "back interior style index = ");
  2149.   writeinteger(dest, bundl->back_style_ind);
  2150.   phinprintf(dest, "back interior colour:\n");
  2151.   phinprintf(dest, "colour type = ");
  2152.   writegcolr(dest, &bundl->back_colr);
  2153.   phinprintf(dest, "back reflectance model = %d\n", 
  2154.              bundl->back_refl_eqn);
  2155.   phinprintf(dest, "back shading method = %d\n", bundl->back_shad_meth);
  2156.   phinprintf(dest, "back reflectance properties:\n");
  2157.   writereflprops(dest, &bundl->back_refl_props);
  2158.   phinprintf(dest, "approximation method = %d\n", bundl->approx_type);
  2159.   phinprintf(dest, "approximation value, U = %f\n", bundl->approx_val[0]);
  2160.   phinprintf(dest, "approximation value, V = %f\n", bundl->approx_val[1]);
  2161. }  /* writeinterbundleplus */
  2162.  
  2163. /*--------------------------------------------------------------------------*/
  2164.  
  2165. static void writelinebundleplus(C(ptkedest) dest, 
  2166.                                 C(Pline_bundle_plus *) bundl)
  2167. PreANSI(ptkedest dest)
  2168. PreANSI(Pline_bundle_plus *bundl)
  2169. {
  2170.   phinprintf(dest, "linetype = ");
  2171.   writeinteger(dest, bundl->type);
  2172.   phinprintf(dest, "linewidth scale factor = ");
  2173.   writereal(dest, bundl->width);
  2174.   phinprintf(dest, "line colour:\n");
  2175.   phinprintf(dest, "colour type = ");
  2176.   writegcolr(dest, &bundl->colr);
  2177.   phinprintf(dest, "shading method = %d\n", bundl->shad_meth);
  2178.   phinprintf(dest, "curve approx type = %d\n", bundl->approx_type);
  2179.   phinprintf(dest, "curve approx value = %f\n", bundl->approx_val);  
  2180. }  /* writelinebundleplus */
  2181.  
  2182. /*--------------------------------------------------------------------------*/
  2183.  
  2184. static void writemarkerbundleplus(C(ptkedest) dest, 
  2185.                                   C(Pmarker_bundle_plus *) bundl)
  2186. PreANSI(ptkedest dest)
  2187. PreANSI(Pmarker_bundle_plus *bundl)
  2188. {
  2189.   phinprintf(dest, "markertype = ");
  2190.   writeinteger(dest, bundl->type);
  2191.   phinprintf(dest, "marker size scale factor = ");
  2192.   writereal(dest, bundl->size );
  2193.   phinprintf(dest, "marker colour:\n");
  2194.   phinprintf(dest, "colour type = ");
  2195.   writegcolr(dest, &bundl->colr);
  2196. }  /* writemarkerbundleplus */
  2197.  
  2198. /*--------------------------------------------------------------------------*/
  2199.  
  2200. static void writetextbundleplus(C(ptkedest) dest, 
  2201.                                 C(Ptext_bundle_plus *) bundl)
  2202. PreANSI(ptkedest dest)
  2203. PreANSI(Ptext_bundle_plus *bundl)
  2204. {
  2205.   phinprintf(dest, "text font = ");
  2206.   writeinteger(dest, bundl->font);
  2207.   phinprintf(dest, "text precision = ");
  2208.   writephigsenum(dest, PTKETXPREC, bundl->prec);
  2209.   phinprintf(dest, "character expansion factor = ");
  2210.   writereal(dest, bundl->char_expan);
  2211.   phinprintf(dest, "character spacing = ");
  2212.   writereal(dest, bundl->char_space);
  2213.   phinprintf(dest, "text colour:\n");
  2214.   phinprintf(dest, "colour type = ");
  2215.   writegcolr(dest, &bundl->colr);
  2216. }  /* writetextbundleplus */
  2217.  
  2218. /*--------------------------------------------------------------------------*/
  2219.  
  2220. static void writelightsrcbundle(C(ptkedest) dest, 
  2221.                                 C(Plight_src_bundle *) light)
  2222. PreANSI(ptkedest dest)
  2223. PreANSI(Plight_src_bundle *light)
  2224. {
  2225.   phinprintf(dest, "light source type = %d\n", light->type);
  2226.   switch (light->type)
  2227.   {
  2228.     case PLIGHT_AMBIENT:
  2229.       phinprintf(dest, "light source colour:\n");
  2230.       phinprintf(dest, "colour type = ");
  2231.       writegcolr(dest, &light->rec.ambient.colr);
  2232.       break;
  2233.  
  2234.     case PLIGHT_DIRECTIONAL:
  2235.       phinprintf(dest, "light source colour:\n");
  2236.       phinprintf(dest, "colour type = ");
  2237.       writegcolr(dest, &light->rec.directional.colr);
  2238.       phinprintf(dest, "light source direction:\n");
  2239.       writevector3(dest, &light->rec.directional.dir);      
  2240.       break;
  2241.  
  2242.     case PLIGHT_POSITIONAL:
  2243.       phinprintf(dest, "light source colour:\n");
  2244.       phinprintf(dest, "colour type = ");
  2245.       writegcolr(dest, &light->rec.positional.colr);
  2246.       phinprintf(dest, "light source position:\n");
  2247.       writepoint3(dest, &light->rec.positional.pos);
  2248.       phinprintf(dest, "attenuation coefficients = %f %f\n",
  2249.            light->rec.positional.coef[0], light->rec.positional.coef[1]);
  2250.       break;
  2251.  
  2252.     case PLIGHT_SPOT:
  2253.       phinprintf(dest, "light source colour:\n");
  2254.       phinprintf(dest, "colour type = ");
  2255.       writegcolr(dest, &light->rec.spot.colr);
  2256.       phinprintf(dest, "light source position:\n");
  2257.       writepoint3(dest, &light->rec.spot.pos);
  2258.       phinprintf(dest, "light source direction:\n");
  2259.       writevector3(dest, &light->rec.spot.dir);      
  2260.       phinprintf(dest, "concentration exponent = %f\n",
  2261.                  light->rec.spot.exp);
  2262.       phinprintf(dest, "attenuation coefficients = %f %f\n",
  2263.            light->rec.spot.coef[0], light->rec.spot.coef[1]);
  2264.       phinprintf(dest, "spread angle = %f\n", light->rec.spot.angle);
  2265.       break;
  2266.   }
  2267. }  /* writelightsrcbundle */
  2268.  
  2269. /*--------------------------------------------------------------------------*/
  2270.  
  2271. static void writeparasurfcharacs(C(ptkedest) dest, C(Pint) psctype, 
  2272.                                 C(Ppara_surf_characs *) psurf)
  2273. PreANSI(ptkedest dest)
  2274. PreANSI(Pint psctype)
  2275. PreANSI(Ppara_surf_characs *psurf)
  2276. {
  2277.   switch (psctype)
  2278.   {
  2279.     case PSC_NONE:
  2280.       break;
  2281.  
  2282.     case PSC_WS_DEP:
  2283.       break;
  2284.  
  2285.     case PSC_ISOPARAMETRIC_CURVES:
  2286.       writephigsenum(dest, PTKECURVEPLACE, psurf->psc_3.placement);
  2287.       writeinteger(dest, psurf->psc_3.u_count);
  2288.       writeinteger(dest, psurf->psc_3.v_count);
  2289.       break;
  2290.  
  2291.     case PSC_LEVEL_CURVES_MC:
  2292.       writepoint3(dest, &psurf->psc_4.origin);
  2293.       writevector3(dest, &psurf->psc_4.direction);
  2294.       writefloatlist(dest, &psurf->psc_4.params);
  2295.       break;
  2296.  
  2297.     case PSC_LEVEL_CURVES_WC:
  2298.       writepoint3(dest, &psurf->psc_5.origin);
  2299.       writevector3(dest, &psurf->psc_5.direction);
  2300.       writefloatlist(dest, &psurf->psc_5.params);
  2301.       break;
  2302.   }
  2303. }  /* writeparasurfcharacs */
  2304.  
  2305. /*--------------------------------------------------------------------------*/
  2306.  
  2307. static void writecovalarray(C(ptkedest) dest, C(Pint) type, C(Pint) num, 
  2308.                             C(Pcoval *) colours)
  2309. PreANSI(ptkedest dest)
  2310. PreANSI(Pint type)
  2311. PreANSI(Pint num)
  2312. PreANSI(Pcoval *colours)
  2313. {
  2314.   Pint i;
  2315.  
  2316.   if (type == PINDIRECT)
  2317.   {
  2318.     for (i = 0; i < num; i++)
  2319.       writeintvalue(dest, colours[i].ind, PTKECOLOURIND);
  2320.   }
  2321.   else
  2322.   {
  2323.     for (i = 0; i < num; i++)
  2324.       writecobundl(dest, &colours[i].direct);
  2325.   }
  2326. }  /* writecovalarray */
  2327.  
  2328. /*--------------------------------------------------------------------------*/
  2329.  
  2330. static void writepointlist34(C(ptkedest) dest, C(Prational) rationality, 
  2331.                             C(Ppoint_list34 *) plist)
  2332. PreANSI(ptkedest dest)
  2333. PreANSI(Prational rationality)
  2334. PreANSI(Ppoint_list34 *plist)
  2335. {
  2336.   Pint i, n;
  2337.   char prom[30];
  2338.  
  2339.   writeinteger(dest, plist->num_points);
  2340.   if (rationality == PRATIONAL)
  2341.   {
  2342.     for (i = 0; i < plist->num_points; i++) 
  2343.       writepoint4(dest, &plist->points.point4d[i]);
  2344.   }
  2345.   else
  2346.   {
  2347.     for (i = 0; i < plist->num_points; i++) 
  2348.       writepoint3(dest, &plist->points.point3d[i]);
  2349.   }
  2350. }  /* writepointlist34 */
  2351.  
  2352. /*--------------------------------------------------------------------------*/
  2353.  
  2354. static void writepointgrid34(C(ptkedest) dest, C(Prational) rationality, 
  2355.                             C(Ppoint_grid34 *) plist)
  2356. PreANSI(ptkedest dest)
  2357. PreANSI(Prational rationality)
  2358. PreANSI(Ppoint_grid34 *plist)
  2359. {
  2360.   Pint i, numpts;
  2361.   char prom[30];
  2362.  
  2363.   writeinteger(dest, plist->num_points.u_dim);
  2364.   writeinteger(dest, plist->num_points.v_dim);
  2365.   numpts = plist->num_points.u_dim * plist->num_points.v_dim;
  2366.   if (rationality == PRATIONAL)
  2367.   {
  2368.     for (i = 0; i < numpts; i++) 
  2369.       writepoint4(dest, &plist->points.point4d[i]);
  2370.   }
  2371.   else
  2372.   {
  2373.     for (i = 0; i < numpts; i++) 
  2374.       writepoint3(dest, &plist->points.point3d[i]);
  2375.   }
  2376. }  /* writepointgrid34 */
  2377.  
  2378. /*--------------------------------------------------------------------------*/
  2379.  
  2380. static void writepointlist23(C(ptkedest) dest, C(Prational) rationality, 
  2381.                             C(Ppoint_list23 *) plist)
  2382. PreANSI(ptkedest dest)
  2383. PreANSI(Prational rationality)
  2384. PreANSI(Ppoint_list23 *plist)
  2385. {
  2386.   Pint i, n;
  2387.   char prom[30];
  2388.  
  2389.   writeinteger(dest, plist->num_points);
  2390.   if (rationality == PRATIONAL)
  2391.   {
  2392.     for (i = 0; i < plist->num_points; i++) 
  2393.       writepoint3(dest, &plist->points.point3d[i]);
  2394.   }
  2395.   else
  2396.   {
  2397.     for (i = 0; i < plist->num_points; i++) 
  2398.       writepoint(dest, &plist->points.point2d[i]);
  2399.   }
  2400. }  /* writepointlist23 */
  2401.  
  2402. /*--------------------------------------------------------------------------*/
  2403.  
  2404. static void writefacetvdatalist3(C(ptkedest) dest, C(Pint) vflag, 
  2405.             C(Pint) colour_model, C(Pint) nfa, C(Pfacet_vdata_list3 *) vdata)
  2406. PreANSI(ptkedest dest)
  2407. PreANSI(Pint vflag)
  2408. PreANSI(Pint colour_model)
  2409. PreANSI(Pint nfa)
  2410. PreANSI(Pfacet_vdata_list3 *vdata)
  2411. /*
  2412. ** write list of nfa fill area set and optionally associated colour
  2413. ** information.
  2414. */
  2415. {
  2416.   Pint i, j;
  2417.   char prom[80];
  2418.  
  2419.   for (i = 0; i < nfa; i++)
  2420.   {
  2421.     writeinteger(dest, vdata[i].num_vertices);
  2422.     switch (vflag)
  2423.     {
  2424.       case PVERT_COORD:
  2425.         for (j = 0; j < vdata[i].num_vertices; j++)
  2426.           writepoint3(dest, &vdata[i].vertex_data.points[j]);
  2427.         break;
  2428.  
  2429.       case PVERT_COORD_COLOUR:
  2430.         for (j = 0; j < vdata[i].num_vertices; j++)
  2431.     {
  2432.           writepoint3(dest, &vdata[i].vertex_data.ptcolrs[j].point);
  2433.           if (colour_model == PINDIRECT)
  2434.             writeintvalue(dest, vdata[i].vertex_data.ptcolrs[j].colr.ind, 
  2435.                           PTKECOLOURIND);
  2436.           else
  2437.             writedirectcolour(dest, colour_model, 
  2438.               &vdata[i].vertex_data.ptcolrs[j].colr);
  2439.         }
  2440.         break;
  2441.  
  2442.       case PVERT_COORD_NORMAL:
  2443.         for (j = 0; j < vdata[i].num_vertices; j++)
  2444.     {
  2445.           writepoint3(dest, &vdata[i].vertex_data.ptnorms[j].point);
  2446.           writevector3(dest, &vdata[i].vertex_data.ptnorms[j].norm);
  2447.         }
  2448.         break;
  2449.  
  2450.       case PVERT_COORD_COLOUR_NORMAL:
  2451.         for (j = 0; j < vdata[i].num_vertices; j++)
  2452.     {
  2453.           writepoint3(dest, &vdata[i].vertex_data.ptconorms[j].point);
  2454.           if (colour_model == PINDIRECT)
  2455.             writeintvalue(dest, vdata[i].vertex_data.ptconorms[j].colr.ind,
  2456.                           PTKECOLOURIND);
  2457.           else
  2458.             writedirectcolour(dest, colour_model, 
  2459.               vdata[i].vertex_data.ptconorms[j].colr);
  2460.           writevector3(dest, vdata[i].vertex_data.ptconorms[j].norm);
  2461.         }
  2462.         break;
  2463.     }
  2464.   }
  2465. }  /* writefacetvdatalist3 */
  2466.  
  2467. /*--------------------------------------------------------------------------*/
  2468.  
  2469. static void writefacetvdataarr3(C(ptkedest) dest, C(Pint) vflag, 
  2470.        C(Pint) colour_model, C(Pint) nv, C(Pfacet_vdata_arr3 *) vdata)
  2471. PreANSI(ptkedest dest)
  2472. PreANSI(Pint vflag)
  2473. PreANSI(Pint colour_model)
  2474. PreANSI(Pint nv)
  2475. PreANSI(Pfacet_vdata_arr3 *vdata)
  2476. /*
  2477. ** write list of nfa fill area set and optionally associated colour
  2478. ** information.
  2479. */
  2480. {
  2481.   Pint i, j;
  2482.  
  2483.   switch (vflag)
  2484.   {
  2485.     case PVERT_COORD:
  2486.       for (i = 0; i < nv; i++)
  2487.         writepoint3(dest, &vdata->points[i]);
  2488.       break;
  2489.  
  2490.     case PVERT_COORD_COLOUR:
  2491.       for (i = 0; i < nv; i++)
  2492.       {
  2493.         writepoint3(dest, &vdata->ptcolrs[i].point);
  2494.         if (colour_model == PINDIRECT)
  2495.           writeintvalue(dest, vdata->ptcolrs[i].colr.ind, PTKECOLOURIND);
  2496.         else
  2497.           writedirectcolour(dest, colour_model, 
  2498.                             &vdata->ptcolrs[i].colr);
  2499.       }
  2500.       break;
  2501.  
  2502.     case PVERT_COORD_NORMAL:
  2503.       for (i = 0; i < nv; i++)
  2504.       {
  2505.         writepoint3(dest, &vdata->ptnorms[i].point);
  2506.         writevector3(dest, &vdata->ptnorms[i].norm);
  2507.       }
  2508.       break;
  2509.  
  2510.     case PVERT_COORD_COLOUR_NORMAL:
  2511.       for (i = 0; i < nv; i++)
  2512.       {
  2513.         writepoint3(dest, &vdata->ptconorms[i].point);
  2514.         if (colour_model == PINDIRECT)
  2515.           writeintvalue(dest, vdata->ptconorms[i].colr.ind, PTKECOLOURIND);
  2516.         else
  2517.           writedirectcolour(dest, colour_model, 
  2518.                             &vdata->ptconorms[i].colr);
  2519.         writevector3(dest, &vdata->ptconorms[i].norm);
  2520.       }
  2521.       break;
  2522.   }
  2523. }  /* writefacetvdataarr3 */
  2524.  
  2525. /*--------------------------------------------------------------------------*/
  2526.  
  2527. static void writelinevdatalist3(C(ptkedest) dest, C(Pint) vflag, 
  2528.           C(Pint) colour_model, C(Pint) nfa, C(Pline_vdata_list3 *) vdata)
  2529. PreANSI(ptkedest dest)
  2530. PreANSI(Pint vflag)
  2531. PreANSI(Pint colour_model)
  2532. PreANSI(Pint nfa)
  2533. PreANSI(Pline_vdata_list3 *vdata)
  2534. /*
  2535. ** read list of nfa fill area set and optionally associated colour
  2536. ** information.
  2537. */
  2538. {
  2539.   Pint i, j;
  2540.   char prom[80];
  2541.  
  2542.   for (i = 0; i < nfa; i++)
  2543.   {
  2544.     writeinteger(dest, vdata[i].num_vertices);
  2545.     switch (vflag)
  2546.     {
  2547.       case PVERT_COORD:
  2548.         for (j = 0; j < vdata[i].num_vertices; j++)
  2549.           writepoint3(dest, &vdata[i].vertex_data.points[j]);
  2550.         break;
  2551.  
  2552.       case PVERT_COORD_COLOUR:
  2553.         for (j = 0; j < vdata[i].num_vertices; j++)
  2554.     {
  2555.           writepoint3(dest, &vdata[i].vertex_data.ptcolrs[j].point);
  2556.           if (colour_model == PINDIRECT)
  2557.             writeintvalue(dest, vdata[i].vertex_data.ptcolrs[j].colr.ind,
  2558.                           PTKECOLOURIND);
  2559.           else
  2560.             writedirectcolour(dest, colour_model, 
  2561.               &vdata[i].vertex_data.ptcolrs[j].colr);
  2562.         }
  2563.         break;
  2564.     }
  2565.   }
  2566. }  /* writelinevdatalist3 */
  2567.  
  2568. /*--------------------------------------------------------------------------*/
  2569.  
  2570. static void writefacetdata3(C(ptkedest) dest, C(Pint) fflag, 
  2571.                             C(Pint) colour_model, C(Pfacet_data3 *) fdata)
  2572. PreANSI(ptkedest dest)
  2573. PreANSI(Pint fflag)
  2574. PreANSI(Pint colour_model)
  2575. PreANSI(Pfacet_data3 *fdata)
  2576. /*
  2577. ** read facet data record.
  2578. */
  2579. {
  2580.   char prom[80];
  2581.  
  2582.   switch (fflag)
  2583.   {
  2584.     case PFACET_NONE:
  2585.       break;
  2586.  
  2587.     case PFACET_COLOUR:
  2588.       if (colour_model == PINDIRECT)
  2589.         writeintvalue(dest, fdata->colr.ind, PTKECOLOURIND);
  2590.       else
  2591.         writedirectcolour(dest, colour_model, &fdata->colr);
  2592.       break;
  2593.  
  2594.     case PFACET_NORMAL:
  2595.       writevector3(dest, &fdata->norm);
  2596.       break;
  2597.  
  2598.     case PFACET_COLOUR_NORMAL:
  2599.       if (colour_model == PINDIRECT)
  2600.         writeintvalue(dest, fdata->conorm.colr.ind, PTKECOLOURIND);
  2601.       else
  2602.         writedirectcolour(dest, colour_model, &fdata->conorm.colr);
  2603.       writevector3(dest, &fdata->conorm.norm);
  2604.       break;
  2605.   }
  2606. }  /* writefacetdata3 */
  2607.  
  2608. /*--------------------------------------------------------------------------*/
  2609.  
  2610. static void writefacetdataarr3(C(ptkedest) dest, C(Pint) fflag, 
  2611.           C(Pint) colour_model, C(Pint) num, C(Pfacet_data_arr3 *) fdata)
  2612. PreANSI(ptkedest dest)
  2613. PreANSI(Pint fflag)
  2614. PreANSI(Pint colour_model)
  2615. PreANSI(Pint num)
  2616. PreANSI(Pfacet_data_arr3 *fdata)
  2617. /*
  2618. ** read facet data record.
  2619. */
  2620. {
  2621.   char prom[80];
  2622.   Pint i;
  2623.  
  2624.   switch (fflag)
  2625.   {
  2626.     case PFACET_NONE:
  2627.       break;
  2628.  
  2629.     case PFACET_COLOUR:
  2630.       if (colour_model == PINDIRECT)
  2631.       {
  2632.         for (i = 0; i < num; i++)
  2633.           writeintvalue(dest, fdata->colrs[i].ind, PTKECOLOURIND);
  2634.       }
  2635.       else
  2636.       {
  2637.         for (i = 0; i < num; i++)   
  2638.           writedirectcolour(dest, colour_model, &fdata->colrs[i]);
  2639.       }
  2640.       break;
  2641.  
  2642.     case PFACET_NORMAL:
  2643.       for (i = 0; i < num; i++)   
  2644.         writevector3(dest, &fdata->norms[i]);
  2645.       break;
  2646.  
  2647.     case PFACET_COLOUR_NORMAL:
  2648.       for (i = 0; i < num; i++)   
  2649.       {
  2650.         if (colour_model == PINDIRECT)
  2651.           writeintvalue(dest, fdata->conorms[i].colr.ind, PTKECOLOURIND);
  2652.         else
  2653.           writedirectcolour(dest, colour_model, &fdata->conorms[i].colr);
  2654.         writevector3(dest, &fdata->conorms[i].norm);
  2655.       }
  2656.       break;
  2657.   }
  2658. }  /* writefacetdataarr3 */
  2659.  
  2660. /*--------------------------------------------------------------------------*/
  2661.  
  2662. static void writeedgedatalist(C(ptkedest) dest, C(Pint) nfa, 
  2663.                               C(Pedge_data_list *) edata)
  2664. PreANSI(ptkedest dest)
  2665. PreANSI(Pint nfa)
  2666. PreANSI(Pedge_data_list *edata)
  2667. /*
  2668. ** read list of nfa edge information.
  2669. */
  2670. {
  2671.   Pint i, j;
  2672.  
  2673.   for (i = 0; i < nfa; i++)
  2674.   {
  2675.     writeinteger(dest, edata[i].num_edges);
  2676.     for (j = 0; j < edata[i].num_edges; j++)
  2677.       writephigsenum(dest, PTKEEDGEF, edata[i].edgedata.edges[j]);
  2678.   }
  2679. }  /* writeedgedatalist */
  2680.  
  2681. /*--------------------------------------------------------------------------*/
  2682.  
  2683. static void writeedgedatalistlist(C(ptkedest) dest,
  2684.                                  C(Pedge_data_list_list *) edata)
  2685. PreANSI(ptkedest dest)
  2686. PreANSI(Pedge_data_list_list *edata)
  2687. /*
  2688. ** read list of edge lists information.
  2689. */
  2690. {
  2691.   Pint i, j;
  2692.   char prom[80];
  2693.  
  2694.   writeinteger(dest, edata->num_lists);
  2695.   for (i = 0; i < edata->num_lists; i++)
  2696.   {
  2697.     writeinteger(dest, edata->edgelist[i].num_edges);
  2698.     for (j = 0; j < edata->edgelist[i].num_edges; j++)
  2699.       writephigsenum(dest, PTKEEDGEF, edata->edgelist[i].edgedata.edges[j]);
  2700.   }
  2701. }  /* writeedgedatalistlist */
  2702.  
  2703. /*--------------------------------------------------------------------------*/
  2704.  
  2705. static void writetrimcurvelist(C(ptkedest) dest, C(Ptrimcurve_list *) tlist)
  2706. PreANSI(ptkedest dest)
  2707. PreANSI(Ptrimcurve_list *tlist)
  2708. {
  2709.   Pint i;
  2710.  
  2711.   writeinteger(dest, tlist->num_curves);
  2712.   for (i = 0; i < tlist->num_curves; i++)
  2713.   {
  2714.     writephigsenum(dest, PTKEEDGEF, tlist->curves[i].visible);
  2715.     writephigsenum(dest, PTKERATIONAL, tlist->curves[i].rationality);
  2716.     writeinteger(dest, tlist->curves[i].order);
  2717.     writeinteger(dest, tlist->curves[i].approx_type);
  2718.     writereal(dest, tlist->curves[i].approx_val);
  2719.     writefloatlist(dest, &tlist->curves[i].knots);
  2720.     writereal(dest, tlist->curves[i].tmin);
  2721.     writereal(dest, tlist->curves[i].tmax);
  2722.     writepointlist23(dest, tlist->curves[i].rationality, 
  2723.                      &tlist->curves[i].cpts);
  2724.   }
  2725. }  /* writetrimcurvelist */
  2726.  
  2727. /*--------------------------------------------------------------------------*/
  2728.  
  2729. #endif
  2730.  
  2731. static void writeelemcontent(C(ptkedest) dest, C(ptkselcontent *) elcont)
  2732. PreANSI(ptkedest dest)
  2733. PreANSI(ptkselcontent *elcont)
  2734. {
  2735.   Pint i, numpts, namelen, ptindex, size;
  2736.   char elemname[100], str[100];
  2737.  
  2738.   ptk_getelemtypename(elcont->eltype, 100, elemname, &namelen);
  2739.   phinprintf(dest, "%s\n", elemname);
  2740.   switch (elcont->eltype)
  2741.   {
  2742.     case PELEM_NIL:
  2743.     break;
  2744.  
  2745.     case PELEM_POLYLINE3:
  2746.     case PELEM_POLYMARKER3:
  2747.     case PELEM_FILL_AREA3:
  2748.       writepointlst3(dest, &elcont->eldata->point_list3);
  2749.     break;
  2750.  
  2751.     case PELEM_POLYLINE:
  2752.     case PELEM_POLYMARKER:
  2753.     case PELEM_FILL_AREA:
  2754.       writepointlst(dest, &elcont->eldata->point_list);
  2755.     break;
  2756.  
  2757.     case PELEM_TEXT3:
  2758.       writepoint3(dest, &elcont->eldata->text3.pos);
  2759.       writevector3(dest, &elcont->eldata->text3.dir[0]);
  2760.       writevector3(dest, &elcont->eldata->text3.dir[1]);
  2761.       phinprintf(dest, "\"%s\"\n", elcont->eldata->text3.char_string);
  2762.     break;
  2763.  
  2764.     case PELEM_TEXT:
  2765.       writepoint(dest, &elcont->eldata->text.pos);
  2766.       phinprintf(dest, "\"%s\"\n", elcont->eldata->text.char_string);
  2767.     break;
  2768.  
  2769.     case PELEM_ANNO_TEXT_REL3:
  2770.       writepoint3(dest, &elcont->eldata->anno_text_rel3.ref_point);
  2771.       writepoint3(dest, &elcont->eldata->anno_text_rel3.offset);
  2772.       phinprintf(dest, "\"%s\"\n", 
  2773.                  elcont->eldata->anno_text_rel3.char_string);
  2774.     break;
  2775.  
  2776.     case PELEM_ANNO_TEXT_REL:
  2777.       writepoint(dest, &elcont->eldata->anno_text_rel.ref_point);
  2778.       writepoint(dest, &elcont->eldata->anno_text_rel.offset);
  2779.       phinprintf(dest, "\"%s\"\n", elcont->eldata->anno_text_rel.char_string);
  2780.     break;
  2781.  
  2782.     case PELEM_FILL_AREA_SET3:
  2783.       writeinteger(dest, elcont->eldata->point_list_list3.num_point_lists);
  2784.       for (i = 0; i < elcont->eldata->point_list_list3.num_point_lists; i++)
  2785.       {
  2786.         writepointlst3(dest, 
  2787.                        &elcont->eldata->point_list_list3.point_lists[i]);
  2788.       }
  2789.     break;
  2790.  
  2791.     case PELEM_FILL_AREA_SET:
  2792.       writeinteger(dest, elcont->eldata->point_list_list.num_point_lists);
  2793.       for (i = 0; i < elcont->eldata->point_list_list.num_point_lists; i++)
  2794.       {
  2795.         writepointlst(dest, &elcont->eldata->point_list_list.point_lists[i]);
  2796.       }
  2797.     break;
  2798.  
  2799.     case PELEM_CELL_ARRAY3:
  2800.       writepoint3(dest, &elcont->eldata->cell_array3.paral.p);
  2801.       writepoint3(dest, &elcont->eldata->cell_array3.paral.q);
  2802.       writepoint3(dest, &elcont->eldata->cell_array3.paral.r);
  2803.       writeinteger(dest, elcont->eldata->cell_array3.colr_array.dims.size_x);
  2804.       writeinteger(dest, elcont->eldata->cell_array3.colr_array.dims.size_y);
  2805.       writeintarray(dest, 
  2806.                     (elcont->eldata->cell_array3.colr_array.dims.size_x *
  2807.                      elcont->eldata->cell_array3.colr_array.dims.size_y),
  2808.       elcont->eldata->cell_array3.colr_array.colr_array[i], PTKECOLOURIND);
  2809.     break;
  2810.  
  2811.     case PELEM_CELL_ARRAY:
  2812.       writepoint(dest, &elcont->eldata->cell_array.rect.p);
  2813.       writepoint(dest, &elcont->eldata->cell_array.rect.q);
  2814.       writeinteger(dest, elcont->eldata->cell_array.colr_array.dims.size_x);
  2815.       writeinteger(dest, elcont->eldata->cell_array.colr_array.dims.size_y);
  2816.       writeintarray(dest, 
  2817.                     (elcont->eldata->cell_array.colr_array.dims.size_x * 
  2818.                      elcont->eldata->cell_array.colr_array.dims.size_y),
  2819.       elcont->eldata->cell_array.colr_array.colr_array[i], PTKECOLOURIND);
  2820.     break;
  2821.  
  2822.     case PELEM_GDP3:
  2823.       writeinteger(dest, elcont->eldata->gdp3.id);
  2824.     break;
  2825.  
  2826.     case PELEM_GDP:
  2827.       writeinteger(dest, elcont->eldata->gdp.id);
  2828.     break;
  2829.  
  2830.     case PELEM_LINE_IND:
  2831.     case PELEM_MARKER_IND:
  2832.     case PELEM_TEXT_IND:
  2833.     case PELEM_INT_IND:
  2834.     case PELEM_EDGE_IND:
  2835.     case PELEM_LINETYPE:
  2836.     case PELEM_MARKER_TYPE:
  2837.     case PELEM_TEXT_FONT:
  2838.     case PELEM_ANNO_STYLE:
  2839.     case PELEM_INT_STYLE_IND:
  2840.     case PELEM_EDGETYPE:
  2841.     case PELEM_HLHSR_ID:
  2842.       writeinteger(dest, elcont->eldata->int_data);
  2843.     break;
  2844.  
  2845.     case PELEM_EDGE_COLR_IND:
  2846.     case PELEM_INT_COLR_IND:
  2847.     case PELEM_TEXT_COLR_IND:
  2848.     case PELEM_MARKER_COLR_IND:
  2849.     case PELEM_LINE_COLR_IND:
  2850.       writeintvalue(dest, elcont->eldata->int_data, PTKECOLOURIND);
  2851.     break;
  2852.  
  2853.     case PELEM_VIEW_IND:
  2854.       writeintvalue(dest, elcont->eldata->int_data, PTKEVIEWIND);
  2855.     break;
  2856.  
  2857.     case PELEM_LABEL:       
  2858.       writeintvalue(dest, elcont->eldata->int_data, PTKELABELVAL);
  2859.     break;
  2860.  
  2861.     case PELEM_PICK_ID:
  2862.       writeintvalue(dest, elcont->eldata->int_data, PTKEPICKID);
  2863.     break;
  2864.  
  2865.     case PELEM_LINEWIDTH:
  2866.     case PELEM_MARKER_SIZE:
  2867.     case PELEM_CHAR_EXPAN:
  2868.     case PELEM_CHAR_SPACE:
  2869.     case PELEM_CHAR_HT:
  2870.     case PELEM_ANNO_CHAR_HT:
  2871.     case PELEM_EDGEWIDTH:
  2872.       writereal(dest, elcont->eldata->float_data);
  2873.     break;
  2874.  
  2875.     case PELEM_EXEC_STRUCT:
  2876.       writeintvalue(dest, elcont->eldata->int_data, PTKESTRUCTID);
  2877.     break;
  2878.   
  2879.     case PELEM_TEXT_PREC:
  2880.       writephigsenum(dest, PTKETXPREC, elcont->eldata->text_prec);
  2881.     break;
  2882.  
  2883.     case PELEM_CHAR_UP_VEC:
  2884.     case PELEM_ANNO_CHAR_UP_VEC:
  2885.       writevector(dest, &elcont->eldata->char_up_vec);
  2886.     break;
  2887.  
  2888.     case PELEM_TEXT_PATH:
  2889.     case PELEM_ANNO_PATH:
  2890.       writephigsenum(dest, PTKETXPATH, elcont->eldata->text_path);
  2891.     break;
  2892.  
  2893.     case PELEM_TEXT_ALIGN:
  2894.     case PELEM_ANNO_ALIGN:
  2895.       writephigsenum(dest, PTKETXHOR, elcont->eldata->text_align.hor);
  2896.       writephigsenum(dest, PTKETXVER, elcont->eldata->text_align.vert);
  2897.     break;
  2898.  
  2899.     case PELEM_INT_STYLE:
  2900.       writephigsenum(dest, PTKEINTERSTYLE, elcont->eldata->int_style);
  2901.     break;
  2902.  
  2903.     case PELEM_EDGE_FLAG:
  2904.       writephigsenum(dest, PTKEEDGEF, elcont->eldata->edge_flag);
  2905.     break;
  2906.  
  2907.     case PELEM_PAT_SIZE:
  2908.     case PELEM_PAT_REF_POINT:
  2909.       writepoint(dest, &elcont->eldata->pat_ref_point);
  2910.     break;
  2911.  
  2912.     case PELEM_PAT_REF_POINT_VECS:
  2913.       writepoint3(dest, &elcont->eldata->pat_ref_point_vecs.ref_point);
  2914.       writevector3(dest, &elcont->eldata->pat_ref_point_vecs.ref_vec[0]);
  2915.       writevector3(dest, &elcont->eldata->pat_ref_point_vecs.ref_vec[1]);
  2916.     break;
  2917.  
  2918.     case PELEM_ADD_NAMES_SET:
  2919.     case PELEM_REMOVE_NAMES_SET:
  2920.       writeintlst(dest, &elcont->eldata->names, PTKENAME);
  2921.     break;
  2922.  
  2923.     case PELEM_INDIV_ASF:
  2924.       writephigsenum(dest, PTKEATTRID, elcont->eldata->asf.id);
  2925.       writephigsenum(dest, PTKEASF, elcont->eldata->asf.source);
  2926.     break;
  2927.  
  2928.     case PELEM_LOCAL_MODEL_TRAN3:
  2929.       writematrix3(dest, elcont->eldata->local_tran3.matrix);
  2930.       writephigsenum(dest, PTKECOMPTYPE, 
  2931.                      elcont->eldata->local_tran3.compose_type);
  2932.     break;
  2933.  
  2934.     case PELEM_LOCAL_MODEL_TRAN:
  2935.       writematrix3(dest, elcont->eldata->local_tran.matrix);
  2936.       writephigsenum(dest, PTKECOMPTYPE, 
  2937.                      elcont->eldata->local_tran.compose_type);
  2938.     break;
  2939.  
  2940.     case PELEM_GLOBAL_MODEL_TRAN3:
  2941.       writematrix3(dest, elcont->eldata->global_tran3);
  2942.     break;
  2943.  
  2944.     case PELEM_GLOBAL_MODEL_TRAN:
  2945.       writematrix(dest, elcont->eldata->global_tran);
  2946.     break;
  2947.  
  2948.     case PELEM_MODEL_CLIP_VOL3:
  2949.       writeinteger(dest, elcont->eldata->model_clip3.op);
  2950.       /* half space list */
  2951.     break;
  2952.  
  2953.     case PELEM_MODEL_CLIP_VOL:
  2954.       writeinteger(dest, elcont->eldata->model_clip.op);
  2955.       /* half space list */
  2956.     break;
  2957.  
  2958.     case PELEM_MODEL_CLIP_IND:
  2959.       writephigsenum(dest, PTKECLIP, elcont->eldata->clip_ind);
  2960.     break;
  2961.  
  2962.     case PELEM_RESTORE_MODEL_CLIP_VOL:
  2963.     break;
  2964.  
  2965.     case PELEM_APPL_DATA:
  2966.       writeinteger(dest, elcont->eldata->appl_data.size);
  2967.       phinprintf(dest, "\"%s\"\n", elcont->eldata->appl_data.data);
  2968.     break;
  2969.  
  2970.     case PELEM_GSE:
  2971.       writeinteger(dest, elcont->eldata->gse.id);
  2972.     break;
  2973. /* PHIGS PLUS elements */
  2974. #ifdef SUN
  2975.     case PELEM_POLYLINE_SET3_DATA:
  2976.       writeinteger(dest, elcont->eldata->plsd3.vflag);
  2977.       writeinteger(dest, elcont->eldata->plsd3.colr_model);
  2978.       writeinteger(dest, elcont->eldata->plsd3.npl);
  2979.       writelinevdatalist3(dest, elcont->eldata->plsd3.vflag,
  2980.                           elcont->eldata->plsd3.colr_model,
  2981.                elcont->eldata->plsd3.npl, &elcont->eldata->plsd3.vdata);
  2982.       break;
  2983.   
  2984.     case PELEM_FILL_AREA_SET3_DATA:
  2985.       writeinteger(dest, elcont->eldata->fasd3.fflag);
  2986.       writeinteger(dest, elcont->eldata->fasd3.eflag);
  2987.       writeinteger(dest, elcont->eldata->fasd3.vflag);
  2988.       writeinteger(dest, elcont->eldata->fasd3.colr_model);
  2989.       writefacetdata3(dest, elcont->eldata->fasd3.fflag,
  2990.                       elcont->eldata->fasd3.colr_model,
  2991.                       &elcont->eldata->fasd3.fdata);
  2992.       writeinteger(dest, elcont->eldata->fasd3.nfa);
  2993.       if (elcont->eldata->fasd3.eflag == PEDGE_VISIBILITY)
  2994.         writeedgedatalist(dest, elcont->eldata->fasd3.nfa,
  2995.                           elcont->eldata->fasd3.edata);
  2996.       writefacetvdatalist3(dest, elcont->eldata->fasd3.vflag,
  2997.                            elcont->eldata->fasd3.colr_model,
  2998.                            elcont->eldata->fasd3.nfa,
  2999.                            elcont->eldata->fasd3.vdata);
  3000.       break;
  3001.   
  3002.     case PELEM_TRI_STRIP3_DATA:
  3003.       writeinteger(dest, elcont->eldata->tsd3.fflag);
  3004.       writeinteger(dest, elcont->eldata->tsd3.vflag);
  3005.       writeinteger(dest, elcont->eldata->tsd3.colr_model);
  3006.       writeinteger(dest, elcont->eldata->tsd3.nv);
  3007.       writefacetdataarr3(dest, elcont->eldata->tsd3.fflag,
  3008.                          elcont->eldata->tsd3.colr_model,
  3009.                          elcont->eldata->tsd3.nv,
  3010.                          &elcont->eldata->tsd3.fdata);
  3011.       writefacetvdataarr3(dest, elcont->eldata->tsd3.vflag,
  3012.                           elcont->eldata->tsd3.colr_model,
  3013.                           elcont->eldata->tsd3.nv,
  3014.                           &elcont->eldata->tsd3.vdata);
  3015.       break;
  3016.   
  3017.     case PELEM_QUAD_MESH3_DATA:
  3018.       writeinteger(dest, elcont->eldata->qmd3.fflag);
  3019.       writeinteger(dest, elcont->eldata->qmd3.vflag);
  3020.       writeinteger(dest, elcont->eldata->qmd3.colr_model);
  3021.       writeintsize(dest, &elcont->eldata->qmd3.dim);
  3022.       numpts = elcont->eldata->qmd3.dim.size_x * 
  3023.                elcont->eldata->qmd3.dim.size_y;
  3024.       writefacetdataarr3(dest, elcont->eldata->qmd3.fflag,
  3025.                          elcont->eldata->qmd3.colr_model,
  3026.                          numpts, &elcont->eldata->qmd3.fdata);
  3027.       writefacetvdataarr3(dest, elcont->eldata->qmd3.vflag,
  3028.                           elcont->eldata->qmd3.colr_model,
  3029.                           numpts, &elcont->eldata->qmd3.vdata);
  3030.       break;
  3031.   
  3032.     case PELEM_SET_OF_FILL_AREA_SET3_DATA:
  3033.       writeinteger(dest, elcont->eldata->sofas3.fflag);
  3034.       writeinteger(dest, elcont->eldata->sofas3.eflag);
  3035.       writeinteger(dest, elcont->eldata->sofas3.vflag);
  3036.       writeinteger(dest, elcont->eldata->sofas3.colr_model);
  3037.       writeinteger(dest, elcont->eldata->sofas3.num_sets);
  3038.       writefacetdataarr3(dest, elcont->eldata->sofas3.fflag,
  3039.                          elcont->eldata->sofas3.colr_model,
  3040.                          elcont->eldata->sofas3.num_sets,
  3041.                          &elcont->eldata->sofas3.fdata);
  3042.       if (elcont->eldata->sofas3.eflag == PEDGE_VISIBILITY)
  3043.         writeedgedatalistlist(dest, elcont->eldata->sofas3.num_sets, 
  3044.                               elcont->eldata->sofas3.edata);
  3045.       writeintlistlist(dest, elcont->eldata->sofas3.num_sets, 
  3046.                        elcont->eldata->sofas3.vlist);
  3047.       writefacetvdatalist3(dest, elcont->eldata->sofas3.vflag,
  3048.                            elcont->eldata->sofas3.colr_model,
  3049.                            elcont->eldata->sofas3.num_sets,
  3050.                            &elcont->eldata->sofas3.vdata);
  3051.       break;
  3052.   
  3053.     case PELEM_NUNI_BSP_CURVE:
  3054.       writeinteger(dest, elcont->eldata->nurb_curve.order);
  3055.       writefloatlist(dest, &elcont->eldata->nurb_curve.knots);
  3056.       writephigsenum(dest, PTKERATIONAL, 
  3057.                      elcont->eldata->nurb_curve.rationality);
  3058.       writepointlist34(dest, elcont->eldata->nurb_curve.rationality,
  3059.                        &elcont->eldata->nurb_curve.cpts);
  3060.       writereal(dest, elcont->eldata->nurb_curve.min);
  3061.       writereal(dest, elcont->eldata->nurb_curve.max);
  3062.       break;
  3063.   
  3064.     case PELEM_NUNI_BSP_SURF:
  3065.       writeinteger(dest, elcont->eldata->nurb_surf.u_order);
  3066.       writeinteger(dest, elcont->eldata->nurb_surf.v_order);
  3067.       writefloatlist(dest, &elcont->eldata->nurb_surf.uknots);
  3068.       writefloatlist(dest, &elcont->eldata->nurb_surf.vknots);
  3069.       writephigsenum(dest, PTKERATIONAL,
  3070.                      elcont->eldata->nurb_surf.rationality);
  3071.       writepointgrid34(dest, elcont->eldata->nurb_surf.rationality,
  3072.                        &elcont->eldata->nurb_surf.grid);
  3073.       writeinteger(dest, elcont->eldata->nurb_surf.num_trim_loops);
  3074.       for (i = 0; i < elcont->eldata->nurb_surf.num_trim_loops; i++)
  3075.         writetrimcurvelist(dest, &elcont->eldata->nurb_surf.trim_loops[i]);
  3076.       break;
  3077.   
  3078.     case PELEM_CELL_ARRAY3_PLUS:
  3079.       writeparal(dest, &elcont->eldata->cell_array_plus.paral);
  3080.       writeintsize(dest, &elcont->eldata->cell_array_plus.colr_array.dims);
  3081.       writeinteger(dest, elcont->eldata->cell_array_plus.colr_array.type);
  3082.       writecovalarray(dest, 
  3083.                     elcont->eldata->cell_array_plus.colr_array.colr_array);
  3084.       break;
  3085.   
  3086.     case PELEM_TEXT_COLR:
  3087.     case PELEM_MARKER_COLR:
  3088.     case PELEM_EDGE_COLR:
  3089.     case PELEM_LINE_COLR:
  3090.     case PELEM_INT_COLR:
  3091.     case PELEM_BACK_INT_COLR:
  3092.       writegcolr(dest, &elcont->eldata->colr);
  3093.       break;
  3094.   
  3095.     case PELEM_CURVE_APPROX_CRIT:
  3096.       writeinteger(dest, elcont->eldata->curv_approx.type);
  3097.       writereal(dest, elcont->eldata->curv_approx.value);
  3098.       break;
  3099.   
  3100.     case PELEM_LINE_SHAD_METH:
  3101.     case PELEM_BACK_INT_STYLE_IND:
  3102.     case PELEM_INT_SHAD_METH:
  3103.     case PELEM_BACK_INT_SHAD_METH:
  3104.     case PELEM_INT_REFL_EQN:
  3105.     case PELEM_BACK_INT_REFL_EQN:
  3106.     case PELEM_DCUE_IND:
  3107.     case PELEM_COLR_MAP_IND:
  3108.     case PELEM_RENDERING_COLR_MODEL:
  3109.       writeinteger(dest, elcont->eldata->int_data);
  3110.       break;
  3111.   
  3112.     case PELEM_BACK_INT_STYLE:
  3113.       writephigsenum(dest, PTKEINTERSTYLE, elcont->eldata->int_style);
  3114.       break;
  3115.   
  3116.     case PELEM_REFL_PROPS:
  3117.     case PELEM_BACK_REFL_PROPS:
  3118.       writereflprops(dest, &elcont->eldata->props);
  3119.       break;
  3120.   
  3121.     case PELEM_SURF_APPROX_CRIT:
  3122.       writeinteger(dest, elcont->eldata->surf_approx.type);
  3123.       writereal(dest, elcont->eldata->surf_approx.u_val);
  3124.       writereal(dest, elcont->eldata->surf_approx.v_val);
  3125.       break;
  3126.   
  3127.     case PELEM_PARA_SURF_CHARACS:
  3128.       writeinteger(dest, elcont->eldata->para_surf_characs.type);
  3129.       writeparasurfcharacs(dest, elcont->eldata->para_surf_characs.type,
  3130.                            &elcont->eldata->para_surf_characs.data);
  3131.       break;
  3132.   
  3133.     case PELEM_FACE_DISTING_MODE:
  3134.       writephigsenum(dest, PTKEDISTINGMODE, elcont->eldata->disting_mode);
  3135.       break;
  3136.   
  3137.     case PELEM_FACE_CULL_MODE:
  3138.       writephigsenum(dest, PTKECULLMODE, elcont->eldata->cull_mode);
  3139.       break;
  3140.   
  3141.     case PELEM_LIGHT_SRC_STATE:
  3142.       writeintlst(dest, &elcont->eldata->lss.activation);
  3143.       writeintlst(dest, &elcont->eldata->lss.deactivation);
  3144.       break;
  3145. #endif
  3146.   }
  3147. }
  3148.   
  3149. /*--------------------------------------------------------------------------*/
  3150.   
  3151. static void writelnbundl(C(ptkedest) dest, C(Pline_bundle *) bundl)
  3152. PreANSI(ptkedest dest)
  3153. PreANSI(Pline_bundle *bundl)
  3154. {
  3155.   phinprintf(dest, "linetype = ");
  3156.   writeinteger(dest, bundl->type);
  3157.   phinprintf(dest, "linewidth scale factor = ");
  3158.   writereal(dest, bundl->width);
  3159.   phinprintf(dest, "line colour = ");
  3160.   writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
  3161. }
  3162.  
  3163. /*--------------------------------------------------------------------------*/
  3164.  
  3165. static void writemkbundl(C(ptkedest) dest, C(Pmarker_bundle *) bundl)
  3166. PreANSI(ptkedest dest)
  3167. PreANSI(Pmarker_bundle *bundl)
  3168. {
  3169.   phinprintf(dest, "markertype = ");
  3170.   writeinteger(dest, bundl->type);
  3171.   phinprintf(dest, "marker size scale factor = ");
  3172.   writereal(dest, bundl->size );
  3173.   phinprintf(dest, "marker colour = ");
  3174.   writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
  3175. }
  3176.  
  3177. /*--------------------------------------------------------------------------*/
  3178.  
  3179. static void writetxbundl(C(ptkedest) dest, C(Ptext_bundle *) bundl)
  3180. PreANSI(ptkedest dest)
  3181. PreANSI(Ptext_bundle *bundl)
  3182. {
  3183.   phinprintf(dest, "text font = ");
  3184.   writeinteger(dest, bundl->font);
  3185.   phinprintf(dest, "text precision = ");
  3186.   writephigsenum(dest, PTKETXPREC, bundl->prec);
  3187.   phinprintf(dest, "character expansion factor = ");
  3188.   writereal(dest, bundl->char_expan);
  3189.   phinprintf(dest, "character spacing = ");
  3190.   writereal(dest, bundl->char_space);
  3191.   phinprintf(dest, "text colour = ");
  3192.   writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
  3193. }
  3194.  
  3195. /*--------------------------------------------------------------------------*/
  3196.  
  3197. static void writeinterbundl(C(ptkedest) dest, C(Pint_bundle *) bundl)
  3198. PreANSI(ptkedest dest)
  3199. PreANSI(Pint_bundle *bundl)
  3200. {
  3201.   phinprintf(dest, "interior style = ");
  3202.   writephigsenum(dest, PTKEINTERSTYLE, bundl->style);
  3203.   phinprintf(dest, "interior style index = ");
  3204.   writeinteger(dest, bundl->style_ind);
  3205.   phinprintf(dest, "interior colour = ");
  3206.   writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
  3207. }
  3208.  
  3209. /*--------------------------------------------------------------------------*/
  3210.  
  3211. static void writeedgebundl(C(ptkedest) dest, C(Pedge_bundle *) bundl)
  3212. PreANSI(ptkedest dest)
  3213. PreANSI(Pedge_bundle *bundl)
  3214. {
  3215.   phinprintf(dest, "edge flag = ");
  3216.   writephigsenum(dest, PTKEEDGEF, bundl->flag);
  3217.   phinprintf(dest, "edge type = ");
  3218.   writeinteger(dest, bundl->type);
  3219.   phinprintf(dest, "edgewidth scale factor = ");
  3220.   writereal(dest, bundl->width);
  3221.   phinprintf(dest, "edge colour = ");
  3222.   writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
  3223. }
  3224.  
  3225. /*--------------------------------------------------------------------------*/
  3226.  
  3227. static void writelnattr(C(ptkedest) dest, C(Pline_attrs *) attr)
  3228. PreANSI(ptkedest dest)
  3229. PreANSI(Pline_attrs *attr)
  3230. {
  3231.   phinprintf(dest, "linetype asf = ");
  3232.   writephigsenum(dest, PTKEASF, attr->type_asf);  
  3233.   phinprintf(dest, "line width asf = ");
  3234.   writephigsenum(dest, PTKEASF, attr->width_asf);  
  3235.   phinprintf(dest, "line colour asf = ");
  3236.   writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
  3237.   phinprintf(dest, "line bundle index = ");
  3238.   writeinteger(dest, attr->ind);
  3239.   writelnbundl(dest, &attr->bundle);  
  3240. }
  3241.  
  3242. /*--------------------------------------------------------------------------*/
  3243.  
  3244. static void writeinterattr(C(ptkedest) dest, C(Pint_attrs *) attr)
  3245. PreANSI(ptkedest dest)
  3246. PreANSI(Pint_attrs *attr)
  3247. {
  3248.   phinprintf(dest, "interior asf = ");
  3249.   writephigsenum(dest, PTKEASF, attr->style_asf);  
  3250.   phinprintf(dest, "interior style asf = ");
  3251.   writephigsenum(dest, PTKEASF, attr->style_ind_asf);  
  3252.   phinprintf(dest, "interior colour asf = ");
  3253.   writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
  3254.   phinprintf(dest, "interior bundle index = ");
  3255.   writeinteger(dest, attr->ind);
  3256.   writeinterbundl(dest, &attr->bundle);  
  3257. }
  3258.  
  3259. /*--------------------------------------------------------------------------*/
  3260.  
  3261. static void writeedgeattr(C(ptkedest) dest, C(Pedge_attrs *) attr)
  3262. PreANSI(ptkedest dest)
  3263. PreANSI(Pedge_attrs *attr)
  3264. {
  3265.   phinprintf(dest, "edge flag asf = ");
  3266.   writephigsenum(dest, PTKEASF, attr->flag_asf);  
  3267.   phinprintf(dest, "edge width asf = ");
  3268.   writephigsenum(dest, PTKEASF, attr->width_asf);  
  3269.   phinprintf(dest, "edge colour asf = ");
  3270.   writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
  3271.   phinprintf(dest, "edge bundle index = ");
  3272.   writeinteger(dest, attr->ind);
  3273.   writeedgebundl(dest, &attr->bundle);  
  3274. }
  3275.  
  3276. /*--------------------------------------------------------------------------*/
  3277.  
  3278. static void writemkattr(C(ptkedest) dest, C(Pmarker_attrs *) attr)
  3279. PreANSI(ptkedest dest)
  3280. PreANSI(Pmarker_attrs *attr)
  3281. {
  3282.   phinprintf(dest, "marker type asf = ");
  3283.   writephigsenum(dest, PTKEASF, attr->type_asf);
  3284.   phinprintf(dest, "marker size asf = ");
  3285.   writephigsenum(dest, PTKEASF, attr->size_asf);  
  3286.   phinprintf(dest, "marker colour asf = ");
  3287.   writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
  3288.   phinprintf(dest, "marker bundle index = ");
  3289.   writeinteger(dest, attr->ind);
  3290.   writemkbundl(dest, &attr->bundle);  
  3291. }
  3292.  
  3293. /*--------------------------------------------------------------------------*/
  3294.  
  3295. static void writechoicerec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3296.                            C(Pchoice_data *) rec)
  3297. PreANSI(ptkedest dest)
  3298. PreANSI(Pint device)
  3299. PreANSI(Pint pet)
  3300. PreANSI(Pchoice_data *rec)
  3301. {
  3302.   /* Implementation dependent code */
  3303. #ifdef SUN
  3304.   switch (device)
  3305.   {
  3306.     case 1: 
  3307.     case 2:
  3308.     case 3: 
  3309.       switch (pet)
  3310.       {
  3311.         case 1:
  3312.           break;
  3313.  
  3314.         case 3:
  3315.           {
  3316.             Pint i;
  3317.             char **chstrings;
  3318.  
  3319.             phinprintf(dest, "number of choice strings = ");
  3320.             writeinteger(dest, rec->pets.pet_r3.num_strings);
  3321.             for (i = 0; i < rec->pets.pet_r3.num_strings; i++)
  3322.               phinprintf(dest, "choice string = %s\n", 
  3323.                          rec->pets.pet_r3.strings[i]);
  3324.           }
  3325.           break;
  3326.       }
  3327.       break;
  3328.  
  3329.     default: break;
  3330.   }
  3331. #endif
  3332. #ifdef HP
  3333.   switch (device)
  3334.   {
  3335.     case 1: 
  3336.       break;
  3337.  
  3338.     default: break;
  3339.   }
  3340. #endif
  3341. }  /* writechoicerec */
  3342.  
  3343. /*--------------------------------------------------------------------------*/
  3344.  
  3345. static void writechoicerec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3346.                            C(Pchoice_data3 *) rec)
  3347. PreANSI(ptkedest dest)
  3348. PreANSI(Pint device)
  3349. PreANSI(Pint pet)
  3350. PreANSI(Pchoice_data3 *rec)
  3351. {
  3352.   /* Implementation dependent code */
  3353. #ifdef SUN
  3354.   writechoicerec(dest, device, pet, (Pchoice_data *)rec);
  3355. #endif
  3356. #ifdef HP
  3357.   switch (device)
  3358.   {
  3359.     case 1: 
  3360.       break;
  3361.  
  3362.     default: break;
  3363.   }
  3364. #endif
  3365. }  /* writechoicerec3 */
  3366.  
  3367. /*--------------------------------------------------------------------------*/
  3368.  
  3369. static void writelocrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3370.                         C(Ploc_data *) rec)
  3371. PreANSI(ptkedest dest)
  3372. PreANSI(Pint device)
  3373. PreANSI(Pint pet)
  3374. PreANSI(Ploc_data *rec)
  3375. {
  3376.   Pint i;
  3377.  
  3378.   /* Implementation dependent code */
  3379. #ifdef SUN
  3380.   switch (device)
  3381.   {
  3382.     case 1: 
  3383.     case 2:
  3384.     case 3: 
  3385.     case 4:
  3386.     case 5:
  3387.       switch (pet)
  3388.       {
  3389.         case 1:
  3390.         case 2:
  3391.         case 3:
  3392.           break;
  3393.  
  3394.         case -2:
  3395.           phinprintf(dest, "crosshair colour index = ");
  3396.           writeintvalue(dest, rec->pets.pet_u2.crosshair_colr, PTKECOLOURIND);
  3397.           break;
  3398.  
  3399.         case -4:
  3400.           writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
  3401.           break;
  3402.  
  3403.         case -5:
  3404.           writelnbundl(dest, &rec->pets.pet_u5.line_bundle);
  3405.           break;
  3406.       }
  3407.  
  3408.     default: break;
  3409.   }
  3410. #endif
  3411. #ifdef HP
  3412.   switch (device)
  3413.   {
  3414.     case 1: 
  3415.     case 2:
  3416.     case 3: 
  3417.     case 4:
  3418.       switch (pet)
  3419.       {
  3420.         case 1:
  3421.           phinprintf(dest, "locator colour index = ");
  3422.           writeintvalue(dest, rec->pets.pet_r1.loc_colr_ind, PTKECOLOURIND);
  3423.           break;
  3424.  
  3425.         case 2:
  3426.           phinprintf(dest, "locator colour index = ");
  3427.           writeintvalue(dest, rec->pets.pet_r2.loc_colr_ind, PTKECOLOURIND);
  3428.           break;
  3429.  
  3430.         case 3:
  3431.           phinprintf(dest, "locator colour index = ");
  3432.           writeintvalue(dest, rec->pets.pet_r3.loc_colr_ind, PTKECOLOURIND);
  3433.           break;
  3434.  
  3435.         case 4:
  3436.           writelnattr(dest, &rec->pets.pet_r4.line_attrs);
  3437.           break;
  3438.  
  3439.         case 5:
  3440.           writephigsenum(dest, PTKECONTROL,
  3441.                          rec->pets.pet_r5.line_fill_ctrl_flag);
  3442.           switch (rec->pets.pet_r5.line_fill_ctrl_flag)
  3443.       {
  3444.             case PFLAG_LINE:
  3445.               writelnattr(dest, &rec->pets.pet_r5.attrs.line_attrs);
  3446.               break;
  3447.  
  3448.             case PFLAG_FILL:
  3449.               writeinterattr(dest, &rec->pets.pet_r5.attrs.int_attrs);
  3450.               break;
  3451.  
  3452.             case PFLAG_FILL_SET:
  3453.               writeinterattr(dest, 
  3454.                              &rec->pets.pet_r5.attrs.fill_set.int_attrs);
  3455.               writeedgeattr(dest, 
  3456.                              &rec->pets.pet_r5.attrs.fill_set.edge_attrs);
  3457.               break;
  3458.           }
  3459.           break;
  3460.  
  3461.         case 6:
  3462.           phinprintf(dest, "locator colour index = ");
  3463.           writeintvalue(dest, rec->pets.pet_r6.loc_colr_ind, PTKECOLOURIND);
  3464.           break;
  3465.  
  3466.         case -1:
  3467.           phinprintf(dest, "locator colour index = ");
  3468.           writeintvalue(dest, rec->pets.pet_u1.loc_colr_ind, PTKECOLOURIND);
  3469.           phinprintf(dest, "rectangle height = %f\n", 
  3470.                      rec->pets.pet_u1.rect_height);
  3471.           phinprintf(dest, "rectangle width = %f\n", 
  3472.                      rec->pets.pet_u1.rect_width);
  3473.           break;
  3474.  
  3475.         case -2:
  3476.           phinprintf(dest, "locator colour index = ");
  3477.           writeintvalue(dest, rec->pets.pet_u2.loc_colr_ind, PTKECOLOURIND);
  3478.           phinprintf(dest, "attachment point: ");
  3479.           writepoint3(dest, &rec->pets.pet_u2.attach_point);
  3480.           phinprintf(dest, "number of point lists = %d\n",
  3481.                      rec->pets.pet_u2.num_point_lists);
  3482.           for (i = 0; i < rec->pets.pet_u2.num_point_lists; i++)
  3483.             writepointlst3(dest, &rec->pets.pet_u2.point_lists[i]);
  3484.           break;
  3485.  
  3486.         case -3:
  3487.           phinprintf(dest, "locator colour index = ");
  3488.           writeintvalue(dest, rec->pets.pet_u3.loc_colr_ind, PTKECOLOURIND);
  3489.           phinprintf(dest, "structure identifier = ");
  3490.           writeintvalue(dest, rec->pets.pet_u3.struct_id, PTKESTRUCTID);
  3491.           phinprintf(dest, "attachment point: ");
  3492.           writepoint3(dest, &rec->pets.pet_u3.attach_point);          
  3493.           break;
  3494.       }
  3495.  
  3496.     default: break;
  3497.   }
  3498. #endif
  3499. }  /* writelocrec */
  3500.  
  3501. /*--------------------------------------------------------------------------*/
  3502.  
  3503. static void writelocrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3504.                          C(Ploc_data3 *) rec)
  3505. PreANSI(ptkedest dest)
  3506. PreANSI(Pint device)
  3507. PreANSI(Pint pet)
  3508. PreANSI(Ploc_data3 *rec)
  3509. {
  3510.   Pint i;
  3511.  
  3512.   /* Implementation dependent code */
  3513. #ifdef SUN
  3514.   writelocrec(dest, device, pet, (Ploc_data *)rec);
  3515. #endif
  3516. #ifdef HP
  3517.   writelocrec(dest, device, pet, (Ploc_data *)rec);
  3518. #endif
  3519. }  /* writelocrec3 */
  3520.  
  3521. /*--------------------------------------------------------------------------*/
  3522.  
  3523. static void writepickrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3524.                          C(Ppick_data *) rec)
  3525. PreANSI(ptkedest dest)
  3526. PreANSI(Pint device)
  3527. PreANSI(Pint pet)
  3528. PreANSI(Ppick_data *rec)
  3529. {
  3530.   /* Implementation dependent code */
  3531. #ifdef SUN
  3532.   switch (device)
  3533.   {
  3534.     case 1: 
  3535.     case 2:
  3536.     case 3: 
  3537.     case 4:
  3538.     case 5:
  3539.     case 6:
  3540.       switch (pet)
  3541.       {
  3542.         case 1:
  3543.           break;
  3544.  
  3545.         case 2:
  3546.           phinprintf(dest, "highlight colour index = ");
  3547.           writeintvalue(dest, rec->pets.pet_r2.highl_colr, PTKECOLOURIND);
  3548.           phinprintf(dest, "number of times to blink = ");
  3549.           writeinteger(dest, rec->pets.pet_r2.highl_count);
  3550.           phinprintf(dest, "number of seconds per half blink = ");
  3551.           writeinteger(dest, rec->pets.pet_r2.highl_duration);
  3552.           phinprintf(dest, "aperture size = ");
  3553.           writereal(dest, &rec->pets.pet_r2.ap_size);
  3554.           break;
  3555.  
  3556.         case 3:
  3557.           phinprintf(dest, "highlight colour index = ");
  3558.           writeintvalue(dest, rec->pets.pet_r3.highl_colr, PTKECOLOURIND);
  3559.           phinprintf(dest, "number of times to blink = ");
  3560.           writeinteger(dest, rec->pets.pet_r3.highl_count);
  3561.           phinprintf(dest, "number of seconds per half blink = ");
  3562.           writeinteger(dest, rec->pets.pet_r3.highl_duration);
  3563.           phinprintf(dest, "aperture size = ");
  3564.           writereal(dest, &rec->pets.pet_r3.ap_size);
  3565.           break;
  3566.  
  3567.         case -1:
  3568.           phinprintf(dest, "highlight colour index = ");
  3569.           writeintvalue(dest, rec->pets.pet_u1.highl_colr, PTKECOLOURIND);
  3570.           phinprintf(dest, "number of times to blink = ");
  3571.           writeinteger(dest, rec->pets.pet_u1.highl_count);
  3572.           phinprintf(dest, "number of seconds per half blink = ");
  3573.           writeinteger(dest, rec->pets.pet_u1.highl_duration);
  3574.           phinprintf(dest, "aperture size = ");
  3575.           writereal(dest, &rec->pets.pet_u1.ap_size);
  3576.           break;
  3577.  
  3578.         case -2:
  3579.           phinprintf(dest, "highlight colour index = ");
  3580.           writeintvalue(dest, rec->pets.pet_u2.highl_colr, PTKECOLOURIND);
  3581.           phinprintf(dest, "number of times to blink = ");
  3582.           writeinteger(dest, rec->pets.pet_u2.highl_count);
  3583.           phinprintf(dest, "number of seconds per half blink = ");
  3584.           writeinteger(dest, rec->pets.pet_u2.highl_duration);
  3585.           phinprintf(dest, "aperture size = ");
  3586.           writereal(dest, &rec->pets.pet_u2.ap_size);
  3587.           break;
  3588.  
  3589.         case -3:
  3590.           phinprintf(dest, "highlight colour index = ");
  3591.           writeintvalue(dest, rec->pets.pet_u3.highl_colr, PTKECOLOURIND);
  3592.           phinprintf(dest, "number of times to blink = ");
  3593.           writeinteger(dest, rec->pets.pet_u3.highl_count);
  3594.           phinprintf(dest, "number of seconds per half blink = ");
  3595.           writeinteger(dest, rec->pets.pet_u3.highl_duration);
  3596.           phinprintf(dest, "aperture size = ");
  3597.           writereal(dest, &rec->pets.pet_u3.ap_size);
  3598.           break;
  3599.  
  3600.         case -4:
  3601.           phinprintf(dest, "highlight colour index = ");
  3602.           writeintvalue(dest, rec->pets.pet_u4.highl_colr, PTKECOLOURIND);
  3603.           phinprintf(dest, "number of times to blink = ");
  3604.           writeinteger(dest, rec->pets.pet_u4.highl_count);
  3605.           phinprintf(dest, "number of seconds per half blink = ");
  3606.           writeinteger(dest, rec->pets.pet_u4.highl_duration);
  3607.           phinprintf(dest, "aperture size = ");
  3608.           writereal(dest, &rec->pets.pet_u4.ap_size);
  3609.           break;
  3610.       }
  3611.  
  3612.     default: break;
  3613.   }
  3614. #endif
  3615. #ifdef HP
  3616.   switch (device)
  3617.   {
  3618.     case 1: 
  3619.     case 2:
  3620.     case 3: 
  3621.       switch (pet)
  3622.       {
  3623.         case 1:
  3624.           phinprintf(dest, "highlight colour index = ");
  3625.           writeintvalue(dest, rec->pets.pet_r1.highl_colr_ind, 
  3626.                         PTKECOLOURIND);  
  3627.           phinprintf(dest, "X dimension of aperture = %f\n",
  3628.                      rec->pets.pet_r1.x_dim);   
  3629.           phinprintf(dest, "Y dimension of aperture = %f\n",
  3630.                      rec->pets.pet_r1.y_dim);
  3631.           phinprintf(dest, "Z dimension of aperture = %f\n",
  3632.                      rec->pets.pet_r1.z_dim);   
  3633.           break;
  3634.  
  3635.         case 2:
  3636.           phinprintf(dest, "highlight colour index = ");
  3637.           writeintvalue(dest, rec->pets.pet_r2.highl_colr_ind, 
  3638.                         PTKECOLOURIND);  
  3639.           phinprintf(dest, "X dimension of aperture = %f\n",
  3640.                      rec->pets.pet_r2.x_dim);   
  3641.           phinprintf(dest, "Y dimension of aperture = %f\n",
  3642.                      rec->pets.pet_r2.y_dim);
  3643.           phinprintf(dest, "Z dimension of aperture = %f\n",
  3644.                      rec->pets.pet_r2.z_dim);   
  3645.           break;
  3646.  
  3647.         case 3:
  3648.           phinprintf(dest, "highlight colour index = ");
  3649.           writeintvalue(dest, rec->pets.pet_r3.highl_colr_ind, 
  3650.                         PTKECOLOURIND);  
  3651.           phinprintf(dest, "X dimension of aperture = %f\n",
  3652.                      rec->pets.pet_r3.x_dim);   
  3653.           phinprintf(dest, "Y dimension of aperture = %f\n",
  3654.                      rec->pets.pet_r3.y_dim);
  3655.           phinprintf(dest, "Z dimension of aperture = %f\n",
  3656.                      rec->pets.pet_r3.z_dim);   
  3657.           break;
  3658.       }
  3659.  
  3660.     default: break;
  3661.   }
  3662. #endif
  3663. }  /* writepickrec */
  3664.  
  3665. /*--------------------------------------------------------------------------*/
  3666.  
  3667. static void writepickrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3668.                            C(Ppick_data3 *) rec)
  3669. PreANSI(ptkedest dest)
  3670. PreANSI(Pint device)
  3671. PreANSI(Pint pet)
  3672. PreANSI(Ppick_data3 *rec)
  3673. {
  3674.   /* Implementation dependent code */
  3675. #ifdef SUN
  3676.   writepickrec(dest, device, pet, (Ppick_data *)rec);
  3677. #endif
  3678. #ifdef HP
  3679.   writepickrec(dest, device, pet, (Ppick_data *)rec);
  3680. #endif
  3681. }  /* writepickrec3 */
  3682.  
  3683. /*--------------------------------------------------------------------------*/
  3684.  
  3685. static void writestringrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3686.                            C(Pstring_data *) rec)
  3687. PreANSI(ptkedest dest)
  3688. PreANSI(Pint device)
  3689. PreANSI(Pint pet)
  3690. PreANSI(Pstring_data *rec)
  3691. {
  3692.   /* Implementation dependent code */
  3693. #ifdef SUN
  3694.   switch (device)
  3695.   {
  3696.     case 1: 
  3697.       phinprintf(dest, "buffer size = %d\n", rec->in_buf_size);
  3698.       phinprintf(dest, "initial position = %d\n", rec->init_pos);
  3699.       switch (pet)
  3700.       {
  3701.         case 1:
  3702.           break;
  3703.       }
  3704.  
  3705.     default: break;
  3706.   }
  3707. #endif
  3708. #ifdef HP
  3709.   switch (device)
  3710.   {
  3711.     case 1: 
  3712.       phinprintf(dest, "buffer size = %d\n", rec->in_buf_size);
  3713.       phinprintf(dest, "initial position = %d\n", rec->init_pos);
  3714.       switch (pet)
  3715.       {
  3716.         case 1:
  3717.           phinprintf(dest, "text colour index = ");
  3718.           writeintvalue(dest, rec->pets.pet_r1.text_colr_ind, 
  3719.                         PTKECOLOURIND);            
  3720.           break;
  3721.       }
  3722.  
  3723.     default: break;
  3724.   }
  3725. #endif
  3726. }  /* writestringrec */
  3727.  
  3728. /*--------------------------------------------------------------------------*/
  3729.  
  3730. static void writestringrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3731.                            C(Pstring_data3 *) rec)
  3732. PreANSI(ptkedest dest)
  3733. PreANSI(Pint device)
  3734. PreANSI(Pint pet)
  3735. PreANSI(Pstring_data3 *rec)
  3736. {
  3737.   /* Implementation dependent code */
  3738. #ifdef SUN
  3739.   writestringrec(dest, device, pet, (Pstring_data *)rec);
  3740. #endif
  3741. }  /* writestringrec3 */
  3742.  
  3743. /*--------------------------------------------------------------------------*/
  3744.  
  3745. static void writestrokerec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3746.                            C(Pstroke_data *) rec)
  3747. PreANSI(ptkedest dest)
  3748. PreANSI(Pint device)
  3749. PreANSI(Pint pet)
  3750. PreANSI(Pstroke_data *rec)
  3751. {
  3752.   /* Implementation dependent code */
  3753. #ifdef SUN
  3754.   switch (device)
  3755.   {
  3756.     case 1: 
  3757.     case 2:
  3758.     case 3:
  3759.       phinprintf(dest, "buffer size = ");
  3760.       writeinteger(dest, rec->in_buf_size);
  3761.       phinprintf(dest, "editing position = ");
  3762.       writeinteger(dest, rec->init_pos);
  3763.       phinprintf(dest, "x interval = ");
  3764.       writereal(dest, rec->x_interval);
  3765.       phinprintf(dest, "y interval = ");
  3766.       writereal(dest, rec->y_interval);
  3767.       phinprintf(dest, "time interval = ");
  3768.       writereal(dest, rec->time_interval);
  3769.       switch (pet)
  3770.       {
  3771.         case 1:
  3772.           break;
  3773.  
  3774.         case -3:
  3775.           writemkbundl(dest, &rec->pets.pet_u3.marker_bundle);
  3776.           break;          
  3777.  
  3778.         case -4:
  3779.           writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
  3780.           break;          
  3781.       }
  3782.  
  3783.     default: break;
  3784.   }
  3785. #endif
  3786. #ifdef HP
  3787.   switch (device)
  3788.   {
  3789.     case 1: 
  3790.     case 2:
  3791.       phinprintf(dest, "buffer size = ");
  3792.       writeinteger(dest, rec->in_buf_size);
  3793.       phinprintf(dest, "editing position = ");
  3794.       writeinteger(dest, rec->init_pos);
  3795.       phinprintf(dest, "x interval = ");
  3796.       writereal(dest, rec->x_interval);
  3797.       phinprintf(dest, "y interval = ");
  3798.       writereal(dest, rec->y_interval);
  3799.       phinprintf(dest, "time interval = ");
  3800.       writereal(dest, rec->time_interval);
  3801.       switch (pet)
  3802.       {
  3803.         case 1:
  3804.           writelnattr(dest, &rec->pets.pet_r1.line_attrs);
  3805.           break;
  3806.  
  3807.         case 2:
  3808.           break;
  3809.  
  3810.         case 3:
  3811.           writemkattr(dest, &rec->pets.pet_r3.marker_attrs);
  3812.           break;          
  3813.  
  3814.         case 4:
  3815.           writelnattr(dest, &rec->pets.pet_r4.line_attrs);
  3816.           break;          
  3817.       }
  3818.  
  3819.     default: break;
  3820.   }
  3821. #endif
  3822. }  /* writestrokerec */
  3823.  
  3824. /*--------------------------------------------------------------------------*/
  3825.  
  3826. static void writestrokerec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3827.                            C(Pstroke_data3 *) rec)
  3828. PreANSI(ptkedest dest)
  3829. PreANSI(Pint device)
  3830. PreANSI(Pint pet)
  3831. PreANSI(Pstroke_data3 *rec)
  3832. {
  3833.   /* Implementation dependent code */
  3834. #ifdef SUN
  3835.   switch (device)
  3836.   {
  3837.     case 1: 
  3838.     case 2:
  3839.     case 3:
  3840.       phinprintf(dest, "buffer size = ");
  3841.       writeinteger(dest, rec->in_buf_size);
  3842.       phinprintf(dest, "editing position = ");
  3843.       writeinteger(dest, rec->init_pos);
  3844.       phinprintf(dest, "x interval = ");
  3845.       writereal(dest, rec->x_interval);
  3846.       phinprintf(dest, "y interval = ");
  3847.       writereal(dest, rec->y_interval);
  3848.       phinprintf(dest, "z interval = ");
  3849.       writereal(dest, rec->z_interval);
  3850.       phinprintf(dest, "time interval = ");
  3851.       writereal(dest, rec->time_interval);
  3852.       switch (pet)
  3853.       {
  3854.         case 1:
  3855.           break;
  3856.  
  3857.         case -3:
  3858.           writemkbundl(dest, &rec->pets.pet_u3.marker_bundle);
  3859.           break;          
  3860.  
  3861.         case -4:
  3862.           writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
  3863.           break;          
  3864.       }
  3865.  
  3866.     default: break;
  3867.   }
  3868. #endif
  3869. #ifdef HP
  3870.   switch (device)
  3871.   {
  3872.     case 1: 
  3873.     case 2:
  3874.       phinprintf(dest, "buffer size = ");
  3875.       writeinteger(dest, rec->in_buf_size);
  3876.       phinprintf(dest, "editing position = ");
  3877.       writeinteger(dest, rec->init_pos);
  3878.       phinprintf(dest, "x interval = ");
  3879.       writereal(dest, rec->x_interval);
  3880.       phinprintf(dest, "y interval = ");
  3881.       writereal(dest, rec->y_interval);
  3882.       phinprintf(dest, "z interval = ");
  3883.       writereal(dest, rec->z_interval);
  3884.       phinprintf(dest, "time interval = ");
  3885.       writereal(dest, rec->time_interval);
  3886.       switch (pet)
  3887.       {
  3888.         case 1:
  3889.           writelnattr(dest, &rec->pets.pet_r1.line_attrs);
  3890.           break;
  3891.  
  3892.         case 2:
  3893.           break;
  3894.  
  3895.         case 3:
  3896.           writemkattr(dest, &rec->pets.pet_r3.marker_attrs);
  3897.           break;          
  3898.  
  3899.         case 4:
  3900.           writelnattr(dest, &rec->pets.pet_r4.line_attrs);
  3901.           break;          
  3902.       }
  3903.  
  3904.     default: break;
  3905.   }
  3906. #endif
  3907. }  /* writestrokerec3 */
  3908.  
  3909. /*--------------------------------------------------------------------------*/
  3910.  
  3911. static void writevalrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3912.                         C(Pval_data *) rec)
  3913. PreANSI(ptkedest dest)
  3914. PreANSI(Pint device)
  3915. PreANSI(Pint pet)
  3916. PreANSI(Pval_data *rec)
  3917. {
  3918.   /* Implementation dependent code */
  3919. #ifdef SUN
  3920.   switch (device)
  3921.   {
  3922.     case 1: 
  3923.     case 2:
  3924.     case 3:
  3925.     case 4:
  3926.     case 5:
  3927.     case 6:
  3928.     case 7:
  3929.     case 8:
  3930.     case 9:
  3931.     case 10:
  3932.       phinprintf(dest, "low limit = ");
  3933.       writereal(dest, rec->low);
  3934.       phinprintf(dest, "high limit = ");
  3935.       writereal(dest, rec->high);
  3936.       switch (pet)
  3937.       {
  3938.         case 1:
  3939.           break;
  3940.  
  3941.         case -1:
  3942.           phinprintf(dest, "label = %s\n", rec->pets.pet_u1.label);
  3943.           phinprintf(dest, "format = %s\n", rec->pets.pet_u1.format);
  3944.           phinprintf(dest, "low label = %s\n", rec->pets.pet_u1.low_label);
  3945.           phinprintf(dest, "high label = %s\n", rec->pets.pet_u1.high_label);
  3946.           break;          
  3947.       }
  3948.  
  3949.     default: break;
  3950.   }
  3951. #endif
  3952. #ifdef HP
  3953.   switch (device)
  3954.   {
  3955.     case 10: 
  3956.     case 11:
  3957.     case 12:
  3958.     case 13:
  3959.     case 14:
  3960.     case 15:
  3961.     case 16:
  3962.     case 17:
  3963.     case 18:
  3964.       phinprintf(dest, "low limit = ");
  3965.       writereal(dest, rec->low_value);
  3966.       phinprintf(dest, "high limit = ");
  3967.       writereal(dest, rec->high_value);
  3968.       switch (pet)
  3969.       {
  3970.         case 1:
  3971.           phinprintf(dest, "slider outline colour index = ");
  3972.           writeintvalue(dest, rec->pets.pet_r1.slider_colr_ind, 
  3973.                         PTKECOLOURIND);
  3974.           break;
  3975.       }
  3976.  
  3977.     default: break;
  3978.   }
  3979. #endif
  3980. }  /* writevalrec */
  3981.  
  3982. /*--------------------------------------------------------------------------*/
  3983.  
  3984. static void writevalrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet, 
  3985.                          C(Pval_data3 *) rec)
  3986. PreANSI(ptkedest dest)
  3987. PreANSI(Pint device)
  3988. PreANSI(Pint pet)
  3989. PreANSI(Pval_data3 *rec)
  3990. {
  3991.   /* Implementation dependent code */
  3992. #ifdef SUN
  3993.   writevalrec(dest, device, pet, (Pval_data *)rec);
  3994. #endif
  3995. #ifdef HP
  3996.   writevalrec(dest, device, pet, (Pval_data *)rec);
  3997. #endif
  3998. }  /* writevalrec3 */
  3999.  
  4000. /*--------------------------------------------------------------------------*/
  4001. /*-------------------- general reading functions ---------------------------*/
  4002. /*--------------------------------------------------------------------------*/
  4003.  
  4004. static void checkabort(C(char *) str)
  4005. PreANSI(char *str)
  4006. /* check if ABORT has been entered to abort a phigs function call */
  4007. {
  4008.   if ((strncmp(str, "ABORT", 5) == 0) && (phinteron))
  4009.   {
  4010.     phinprintf(PTKEINFORM, "Phinter: function aborted.\n");
  4011.     longjmp(PFABORT, 1);
  4012.   }
  4013. }  /* checkabort */
  4014.  
  4015. /*--------------------------------------------------------------------------*/
  4016.  
  4017. static void stripstr(C(char *) str, C(char) stripch)
  4018. PreANSI(char *str)
  4019. PreANSI(char stripch)
  4020. /* strip all 'stripch' characters from string */
  4021. {
  4022.   Pint i, j;
  4023.   ptkboolean stripped;
  4024.   char ch;
  4025.  
  4026.   i = j = 0;
  4027.   stripped = FALSE;
  4028.   while (!stripped)
  4029.   {
  4030.     ch = str[i];
  4031.     if (ch == '\0')
  4032.       stripped = TRUE;
  4033.     else
  4034.     if (ch != stripch)
  4035.     {
  4036.       str[j] = ch;
  4037.       j++;
  4038.     }
  4039.     i++;
  4040.   }
  4041.   str[j] = '\0';
  4042. }  /* stripstr */
  4043.  
  4044. /*--------------------------------------------------------------------------*/
  4045.  
  4046. static void readquote(C(char *) str, C(char *) prom)
  4047. PreANSI(char *str)
  4048. PreANSI(char *prom)
  4049. /*
  4050. ** Reads a string. if the first non-blank character found is
  4051. ** a double quote ("), the string is assumed to quoted, and must
  4052. ** be "string", on one line. otherwise, the next sequence of
  4053. ** non-blank characters will be returned as the string.
  4054. */
  4055. {
  4056.   Pint wi;
  4057.   Pint ch;
  4058.   ptkboolean finished;
  4059.   
  4060.   if (fileswitch)
  4061.   {
  4062.     set_i_prompt(prom);
  4063.     wi = 0;
  4064.     finished = FALSE;
  4065.     ch =  getc(inputscript);
  4066.     while ((ch == ' ' || ch == '\n') && (ch != EOF))
  4067.       ch = getc(inputscript);
  4068.     if (ch == EOF)
  4069.     {
  4070.       str[wi++] = EOF;
  4071.       finished = TRUE;
  4072.     }
  4073.     while (!finished)
  4074.     {
  4075.       str[wi] = ch;
  4076.       wi++;
  4077.       if ((ch == '"') && (wi > 1))
  4078.         finished = TRUE;
  4079.       else
  4080.         ch = getc(inputscript);
  4081.     }
  4082.   }
  4083.   else
  4084.   {
  4085.     char prompt[80];
  4086.  
  4087.     sprintf(prompt, "%s> ", prom);
  4088.     ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
  4089.   }
  4090.   str[wi] = '\0';
  4091.   stripstr(str, '"');
  4092.   checkabort(str);
  4093. }  /* readquote */
  4094.  
  4095. /*--------------------------------------------------------------------------*/
  4096.  
  4097. static void readstring(C(char *) str, C(char *) prom)
  4098. PreANSI(char *str)
  4099. PreANSI(char *prom)
  4100. /*
  4101. ** Reads a string. if the first non-blank character found is
  4102. ** a double quote ("), the string is assumed to quoted, and must
  4103. ** be "string", on one line. otherwise, the next sequence of
  4104. ** non-blank characters will be returned as the string 
  4105. */
  4106. {
  4107.   Pint wi;
  4108.   Pint ch;
  4109.   ptkboolean finished;
  4110.  
  4111.   if (fileswitch)
  4112.   {
  4113.     set_i_prompt(prom);
  4114.     wi = 0;
  4115.     finished = FALSE;
  4116.     ch = getc(inputscript);
  4117.     while ((ch == ' ' || ch == '\n') && (ch != EOF))
  4118.       ch = getc(inputscript);
  4119.     if (ch == EOF)
  4120.     {
  4121.       str[wi++] = EOF;
  4122.       finished = TRUE;
  4123.     }
  4124.     while (!finished)
  4125.     {
  4126.       str[wi] = ch;
  4127.       wi++;
  4128.       if (ch == '\0')
  4129.         finished = TRUE;
  4130.       else
  4131.       if (ch == '\n' || ch == ' ' || ch == EOF)
  4132.       {
  4133.         finished = TRUE;
  4134.         if (str[0] != '!')
  4135.           wi--;
  4136.       }
  4137.       else
  4138.         ch = getc(inputscript);
  4139.     }
  4140.   }
  4141.   else
  4142.   {
  4143.     char prompt[80];
  4144.  
  4145.     sprintf(prompt, "%s> ", prom);
  4146.     ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
  4147.   }
  4148.   str[wi] = '\0';
  4149.   checkabort(str);
  4150. }  /* readstring */
  4151.  
  4152. /*--------------------------------------------------------------------------*/
  4153.  
  4154. static ptkboolean readfunction(C(char *) str)
  4155. PreANSI(char *str)
  4156. {
  4157.   readstring(str, default_prompt_string);
  4158.   if (str != '\0')
  4159.     return TRUE;
  4160.   else
  4161.     return FALSE;
  4162. }  /* readfunction */
  4163.  
  4164. /*--------------------------------------------------------------------------*/
  4165.  
  4166. static void readargument(C(char *) str, C(char *) prom)
  4167. PreANSI(char *str)
  4168. PreANSI(char *prom)
  4169. {
  4170.   readstring(str, prom);
  4171.   stripstr(str, '"');
  4172.   if (writingscript)
  4173.     phinprintf(PTKEOUTPUT, "\"%s\" ", str);
  4174. }  /* readargument */
  4175.  
  4176. /*--------------------------------------------------------------------------*/
  4177.  
  4178. static Pint readinteger(C(char *) prom)
  4179. PreANSI(char *prom)
  4180. {
  4181.   /* reads a single integer */
  4182.   Pint i;
  4183.   ptkboolean ok;
  4184.   char str[255];
  4185.  
  4186.   readstring(str, prom);
  4187.   i = 0;
  4188.   i = atoi(str);
  4189.   if (writingscript)
  4190.     phinprintf(PTKEOUTPUT, "%d ", i);
  4191.   return i;
  4192. }  /* readinteger */
  4193.  
  4194. /*--------------------------------------------------------------------------*/
  4195.  
  4196. static Pint readposinteger(C(char *) prom)
  4197. PreANSI(char *prom)
  4198. {
  4199.   /* reads a single integer */
  4200.   Pint i;
  4201.   ptkboolean ok;
  4202.   char str[255];
  4203.  
  4204.   readstring(str, prom);
  4205.   i = 0;
  4206.   i = atoi(str);
  4207.   while (i < 0)
  4208.   {
  4209.     fprintf(stderr, "Phinter: input integer must be >= 0\n");
  4210.     readstring(str, prom);
  4211.     i = 0;
  4212.     i = atoi(str);    
  4213.   }
  4214.   if (writingscript)
  4215.     phinprintf(PTKEOUTPUT, "%d ", i);
  4216.   return i;
  4217. }  /* readposinteger */
  4218.  
  4219. /*--------------------------------------------------------------------------*/
  4220.  
  4221. static Pint readintvalue(C(char *) prom, C(ptkehashtable) htable)
  4222. PreANSI(char *prom)
  4223. PreANSI(ptkehashtable htable)
  4224. {
  4225.   /* reads a single integer */
  4226.   Pint i;
  4227.   ptkboolean ok;
  4228.   char str[80];
  4229.   Pint wi;
  4230.   Pint ch;
  4231.   ptkboolean finished, instring;
  4232.  
  4233.   /* check for required hashtable */
  4234.   switch (htable)
  4235.   {
  4236.     case PTKESTRUCTID:
  4237.       if (!ptk_hashtableused("structureid"))
  4238.       {
  4239.         i = readinteger(prom);
  4240.         return i;
  4241.       }
  4242.       break;    
  4243.  
  4244.     case PTKELABELVAL:
  4245.       if (!ptk_hashtableused("label"))
  4246.       {
  4247.         i = readinteger(prom);
  4248.         return i;
  4249.       }
  4250.       break;
  4251.  
  4252.     case PTKEPICKID:
  4253.       if (!ptk_hashtableused("pickid"))
  4254.       {
  4255.         i = readinteger(prom);
  4256.         return i;
  4257.       }
  4258.       break;
  4259.  
  4260.     case PTKEVIEWIND:
  4261.       if (!ptk_hashtableused("viewindex"))
  4262.       {
  4263.         i = readinteger(prom);
  4264.         return i;
  4265.       }
  4266.       break;
  4267.  
  4268.     case PTKECOLOURIND:
  4269.       if (!ptk_hashtableused("colourindex"))
  4270.       {
  4271.         i = readinteger(prom);
  4272.         return i;
  4273.       }
  4274.       break;
  4275.  
  4276.     case PTKENAME:
  4277.       if (!ptk_hashtableused("name"))
  4278.       {
  4279.         i = readinteger(prom);
  4280.         return i;
  4281.       }
  4282.       break;
  4283.   }
  4284.  
  4285.   instring = FALSE;
  4286.   if (fileswitch)
  4287.   {
  4288.     set_i_prompt(prom);
  4289.     wi = 0;
  4290.     finished = FALSE;
  4291.     ch = getc(inputscript);
  4292.     while ((ch == ' ' || ch == '\n') && (ch != EOF))
  4293.       ch = getc(inputscript);
  4294.     if (ch == EOF)
  4295.     {
  4296.       str[wi++] = EOF;
  4297.       finished = TRUE;
  4298.     }
  4299.     if (ch == '"')
  4300.     {
  4301.       instring = TRUE;
  4302.       while (!finished)
  4303.       {
  4304.         str[wi] = ch;
  4305.         wi++;
  4306.         if ((ch == '"') && (wi > 1))
  4307.           finished = TRUE;
  4308.         else
  4309.           ch = getc(inputscript);
  4310.       }
  4311.       str[wi] = '\0';
  4312.     }
  4313.     else
  4314.     {
  4315.       while (!finished)
  4316.       {
  4317.         str[wi] = ch;
  4318.         wi++;
  4319.         if (ch == '\0')
  4320.           finished = TRUE;
  4321.         else
  4322.         if (ch == '\n' || ch == ' ')
  4323.         {
  4324.           finished = TRUE;
  4325.           wi--;
  4326.         }
  4327.         else
  4328.           ch = getc(inputscript);
  4329.        }
  4330.        str[wi] = '\0';
  4331.     }
  4332.     checkabort(str);
  4333.   }
  4334.   else
  4335.   {
  4336.     char prompt[80];
  4337.  
  4338.     sprintf(prompt, "%s> ", prom);
  4339.     ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
  4340.     checkabort(str);
  4341.     if (strchr(str, '\"') != NULL)
  4342.       instring = TRUE;
  4343.   }
  4344.   if (instring)
  4345.   {
  4346.     if (writingscript)
  4347.       phinprintf(PTKEOUTPUT, "%s ", str);
  4348.     stripstr(str, '"');
  4349.     switch (htable)
  4350.     {
  4351.       case PTKESTRUCTID:
  4352.         return ptk_stringtoint("structureid", str);
  4353.         break;    
  4354.  
  4355.       case PTKELABELVAL:
  4356.         return ptk_stringtoint("label", str);
  4357.         break;    
  4358.  
  4359.       case PTKEPICKID:
  4360.         return ptk_stringtoint("pickid", str);
  4361.         break;    
  4362.  
  4363.       case PTKEVIEWIND:
  4364.         return ptk_stringtoint("viewindex", str);
  4365.         break;    
  4366.  
  4367.       case PTKECOLOURIND:
  4368.         return ptk_stringtoint("colourindex", str);
  4369.         break;    
  4370.  
  4371.       case PTKENAME:
  4372.         return ptk_stringtoint("name", str);
  4373.         break;    
  4374.     }
  4375.   }
  4376.   else
  4377.   {
  4378.     i = atoi(str);
  4379.     if (writingscript)
  4380.       phinprintf(PTKEOUTPUT, "%d ", i);
  4381.     return i;
  4382.   }
  4383. }  /* readintvalue */
  4384.  
  4385. /*--------------------------------------------------------------------------*/
  4386.  
  4387. static Pint readposintvalue(C(char *) prom, C(ptkehashtable) htable)
  4388. PreANSI(char *prom)
  4389. PreANSI(ptkehashtable htable)
  4390. {
  4391.   /* reads a single integer */
  4392.   Pint i;
  4393.   ptkboolean ok;
  4394.   char str[80];
  4395.   Pint wi;
  4396.   Pint ch;
  4397.   ptkboolean finished, instring;
  4398.  
  4399.   /* check for required hashtable */
  4400.   switch (htable)
  4401.   {
  4402.     case PTKESTRUCTID:
  4403.       if (!ptk_hashtableused("structureid"))
  4404.       {
  4405.         i = readposinteger(prom);
  4406.         return i;
  4407.       }
  4408.       break;    
  4409.  
  4410.     case PTKELABELVAL:
  4411.       if (!ptk_hashtableused("label"))
  4412.       {
  4413.         i = readposinteger(prom);
  4414.         return i;
  4415.       }
  4416.       break;
  4417.  
  4418.     case PTKEPICKID:
  4419.       if (!ptk_hashtableused("pickid"))
  4420.       {
  4421.         i = readposinteger(prom);
  4422.         return i;
  4423.       }
  4424.       break;
  4425.  
  4426.     case PTKEVIEWIND:
  4427.       if (!ptk_hashtableused("viewindex"))
  4428.       {
  4429.         i = readposinteger(prom);
  4430.         return i;
  4431.       }
  4432.       break;
  4433.  
  4434.     case PTKECOLOURIND:
  4435.       if (!ptk_hashtableused("colourindex"))
  4436.       {
  4437.         i = readposinteger(prom);
  4438.         return i;
  4439.       }
  4440.       break;
  4441.  
  4442.     case PTKENAME:
  4443.       if (!ptk_hashtableused("name"))
  4444.       {
  4445.         i = readposinteger(prom);
  4446.         return i;
  4447.       }
  4448.       break;
  4449.   }
  4450.  
  4451.   instring = FALSE;
  4452.   if (fileswitch)
  4453.   {
  4454.     set_i_prompt(prom);
  4455.     wi = 0;
  4456.     finished = FALSE;
  4457.     ch = getc(inputscript);
  4458.     while ((ch == ' ' || ch == '\n') && (ch != EOF))
  4459.       ch = getc(inputscript);
  4460.     if (ch == EOF)
  4461.     {
  4462.       str[wi++] = EOF;
  4463.       finished = TRUE;
  4464.     }
  4465.     if (ch == '"')
  4466.     {
  4467.       instring = TRUE;
  4468.       while (!finished)
  4469.       {
  4470.         str[wi] = ch;
  4471.         wi++;
  4472.         if ((ch == '"') && (wi > 1))
  4473.           finished = TRUE;
  4474.         else
  4475.           ch = getc(inputscript);
  4476.       }
  4477.       str[wi] = '\0';
  4478.     }
  4479.     else
  4480.     {
  4481.       while (!finished)
  4482.       {
  4483.         str[wi] = ch;
  4484.         wi++;
  4485.         if (ch == '\0')
  4486.           finished = TRUE;
  4487.         else
  4488.         if (ch == '\n' || ch == ' ')
  4489.         {
  4490.           finished = TRUE;
  4491.           wi--;
  4492.         }
  4493.         else
  4494.           ch = getc(inputscript);
  4495.        }
  4496.        str[wi] = '\0';
  4497.     }
  4498.     checkabort(str);
  4499.   }
  4500.   else
  4501.   {
  4502.     char prompt[80];
  4503.  
  4504.     sprintf(prompt, "%s> ", prom);
  4505.     ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
  4506.     checkabort(str);
  4507.     if (strchr(str, '\"') != NULL)
  4508.       instring = TRUE;
  4509.   }
  4510.   if (instring)
  4511.   {
  4512.     if (writingscript)
  4513.       phinprintf(PTKEOUTPUT, "%s ", str);
  4514.     stripstr(str, '"');
  4515.     switch (htable)
  4516.     {
  4517.       case PTKESTRUCTID:
  4518.         return ptk_stringtoint("structureid", str);
  4519.         break;    
  4520.  
  4521.       case PTKELABELVAL:
  4522.         return ptk_stringtoint("label", str);
  4523.         break;    
  4524.  
  4525.       case PTKEPICKID:
  4526.         return ptk_stringtoint("pickid", str);
  4527.         break;    
  4528.  
  4529.       case PTKEVIEWIND:
  4530.         return ptk_stringtoint("viewindex", str);
  4531.         break;    
  4532.  
  4533.       case PTKECOLOURIND:
  4534.         return ptk_stringtoint("colourindex", str);
  4535.         break;    
  4536.  
  4537.       case PTKENAME:
  4538.         return ptk_stringtoint("name", str);
  4539.         break;    
  4540.     }
  4541.   }
  4542.   else
  4543.   {
  4544.     i = atoi(str);
  4545.     while (i < 0)
  4546.     {
  4547.       fprintf(stderr, "Phinter: input integer must be >= 0\n");
  4548.       i = readposintvalue(prom, htable);
  4549.     }
  4550.     if (writingscript)
  4551.       phinprintf(PTKEOUTPUT, "%d ", i);
  4552.     return i;
  4553.   }
  4554. }  /* readposintvalue */
  4555.  
  4556. /*--------------------------------------------------------------------------*/
  4557.  
  4558. static Pfloat readreal(C(char *) prom)
  4559. PreANSI(char *prom)
  4560. /*
  4561. ** description: 
  4562. ** input params: 
  4563. ** output params: 
  4564. ** return value: 
  4565. */
  4566. {
  4567.   /* reads a single real */
  4568.   Pfloat r;
  4569.   ptkboolean ok;
  4570.   char str[255];
  4571.  
  4572.   readstring(str, prom);
  4573.   r = 0.0;
  4574.   sscanf(str, "%f", &r); 
  4575.   if (writingscript)
  4576.     phinprintf(PTKEOUTPUT, "%f ", r);
  4577.   return r;
  4578. }  /* readreal */
  4579.  
  4580. /*--------------------------------------------------------------------------*/
  4581.  
  4582. static void readmatrix(C(Pmatrix) m, C(char *) prom)
  4583. PreANSI(Pmatrix m)
  4584. PreANSI(char *prom)
  4585. /*
  4586. ** description: 
  4587. ** input params: 
  4588. ** output params: 
  4589. ** return value: 
  4590. */
  4591. {
  4592.   Pint i, j;
  4593.   char prompt[80], str[80];
  4594.  
  4595.   i = j = 0;
  4596.   sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4597.   readstring(str, prompt);
  4598.   if (strncmp(str, "VMM", 3) == 0)
  4599.   {
  4600.     memcpy(m, vmm, sizeof(Pmatrix));
  4601.     if (writingscript)
  4602.       writematrix(PTKEOUTPUT, m);
  4603.   }
  4604.   else
  4605.   if (strncmp(str, "VOM", 3) == 0)
  4606.   {
  4607.     memcpy(m, vom, sizeof(Pmatrix));
  4608.     if (writingscript)
  4609.       writematrix(PTKEOUTPUT, m);
  4610.   }
  4611.   else
  4612.   if (strncmp(str, "TM", 3) == 0)
  4613.   {
  4614.     memcpy(m, tm, sizeof(Pmatrix));
  4615.     if (writingscript)
  4616.       writematrix(PTKEOUTPUT, m);
  4617.   }
  4618.   else
  4619.   {
  4620.     m[i][j] = 0.0;
  4621.     sscanf(str, "%f", &m[i][j]); 
  4622.     for (j = 1; j <= 2; j++)
  4623.     {
  4624.       sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4625.       m[i][j] = readreal(prompt);
  4626.     }
  4627.     for (i = 1; i <= 2; i++) 
  4628.     {
  4629.       for (j = 0; j <= 2; j++)
  4630.       {
  4631.         sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4632.         m[i][j] = readreal(prompt);
  4633.       }
  4634.  
  4635.     }
  4636.   }
  4637.   if (writingscript)
  4638.     phinprintf(PTKEOUTPUT, "\n");  
  4639. }  /* readmatrix */
  4640.  
  4641. /*--------------------------------------------------------------------------*/
  4642.  
  4643. static void readmatrix3(C(Pmatrix3) m, C(char *) prom)
  4644. PreANSI(Pmatrix3 m)
  4645. PreANSI(char *prom)
  4646. /*
  4647. ** description: 
  4648. ** input params: 
  4649. ** output params: 
  4650. ** return value: 
  4651. */
  4652. {
  4653.   Pint i, j;
  4654.   char prompt[80], str[80];
  4655.  
  4656.   i = j = 0;
  4657.   sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4658.   readstring(str, prompt);
  4659.   if (strncmp(str, "VMM3", 3) == 0)
  4660.   {
  4661.     memcpy(m, vmm3, sizeof(Pmatrix3));
  4662.     if (writingscript)
  4663.       writematrix3(PTKEOUTPUT, m);
  4664.   }
  4665.   else
  4666.   if (strncmp(str, "VOM3", 3) == 0)
  4667.   {
  4668.     memcpy(m, vom3, sizeof(Pmatrix3));
  4669.     if (writingscript)
  4670.       writematrix3(PTKEOUTPUT, m);
  4671.   }
  4672.   else
  4673.   if (strncmp(str, "TM3", 3) == 0)
  4674.   {
  4675.     memcpy(m, tm3, sizeof(Pmatrix3));
  4676.     if (writingscript)
  4677.       writematrix3(PTKEOUTPUT, m);
  4678.   }
  4679.   else
  4680.   {
  4681.     m[i][j] = 0.0;
  4682.     sscanf(str, "%f", &m[i][j]); 
  4683.     for (j = 1; j <= 3; j++)
  4684.     {
  4685.       sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4686.       m[i][j] = readreal(prompt);
  4687.     }
  4688.     for (i = 1; i <= 3; i++) 
  4689.     {
  4690.       for (j = 0; j <= 3; j++)
  4691.       {
  4692.         sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
  4693.         m[i][j] = readreal(prompt);
  4694.       }
  4695.  
  4696.     }
  4697.   }
  4698.   if (writingscript)
  4699.     phinprintf(PTKEOUTPUT, "\n");  
  4700. }  /* readmatrix3 */
  4701.  
  4702. /*--------------------------------------------------------------------------*/
  4703.  
  4704. static void readintlst(C(Pint_list *) nlist, C(char *) prom, 
  4705.                         C(ptkehashtable) htable)
  4706. PreANSI(Pint_list *nlist)
  4707. PreANSI(char *prom)
  4708. PreANSI(ptkehashtable htable)
  4709. /*
  4710. ** description: 
  4711. ** input params: 
  4712. ** output params: 
  4713. ** return value: 
  4714. */
  4715. {
  4716.   Pint i;
  4717.   char prompt[255];
  4718.  
  4719.   sprintf(prompt, "%s, number ? ", prom);
  4720.   nlist->num_ints = readposinteger(prompt);
  4721.   prompt[0] = '\0';
  4722.   nlist->ints = (Pint *)calloc(nlist->num_ints, sizeof(Pint));
  4723.   for (i = 0; i < nlist->num_ints; i++) 
  4724.   {
  4725.     sprintf(prompt, "%s, integer [%d]? ", prom, i);
  4726.     nlist->ints[i] = readintvalue(prompt, htable);
  4727.     if (writingscript)   /* newline between each name */
  4728.       phinprintf(PTKEOUTPUT, "\n");
  4729.   }
  4730. }  /* readintlst */
  4731.  
  4732. /*--------------------------------------------------------------------------*/
  4733.  
  4734. static void readfloatlist(C(Pfloat_list *) nlist, C(char *) prom)
  4735. PreANSI(Pfloat_list *nlist)
  4736. PreANSI(char *prom)
  4737. {
  4738.   Pint i;
  4739.   char prompt[255];
  4740.  
  4741.   sprintf(prompt, "%s, number ? ", prom);
  4742.   nlist->num_floats = readposinteger(prompt);
  4743.   prompt[0] = '\0';
  4744.   nlist->floats = (Pfloat *)calloc(nlist->num_floats, sizeof(Pfloat));
  4745.   for (i = 0; i < nlist->num_floats; i++) 
  4746.   {
  4747.     sprintf(prompt, "%s, float [%d]? ", prom, i);
  4748.     nlist->floats[i] = readreal(prompt);
  4749.     if (writingscript)   /* newline between each name */
  4750.       phinprintf(PTKEOUTPUT, "\n");
  4751.   }
  4752. }  /* readfloatlist */
  4753.  
  4754. /*--------------------------------------------------------------------------*/
  4755.  
  4756. static void readintarray(C(Pint) numints, C(Pint *) nlist, C(char *) prom,
  4757.                          C(ptkehashtable) htable)
  4758. PreANSI(Pint numints)
  4759. PreANSI(Pint *nlist)
  4760. PreANSI(char *prom)
  4761. PreANSI(ptkehashtable htable)
  4762. /*
  4763. ** description: 
  4764. ** input params: 
  4765. ** output params: 
  4766. ** return value: 
  4767. */
  4768. {
  4769.   Pint i;
  4770.   char prompt[255];
  4771.  
  4772.   for (i = 0; i < numints; i++) 
  4773.   {
  4774.     sprintf(prompt, "%s [%d] ? ", prom, i);
  4775.     nlist[i] = readintvalue(prompt, htable);
  4776.     if (writingscript)   /* newline between each name */
  4777.       phinprintf(PTKEOUTPUT, "\n");
  4778.   }
  4779. }  /* readintarray */
  4780.  
  4781. /*--------------------------------------------------------------------------*/
  4782.  
  4783. static Ppoint readpoint(C(char *) prom)
  4784. PreANSI(char *prom)
  4785. /*
  4786. ** description: 
  4787. ** input params: 
  4788. ** output params: 
  4789. ** return value: 
  4790. */
  4791. {
  4792.   Ppoint t;
  4793.   char pointprom[255];
  4794.  
  4795.   sprintf(pointprom, "%s, x ? ", prom);
  4796.   t.x = readreal(pointprom);
  4797.   sprintf(pointprom, "%s, y ? ", prom);
  4798.   t.y = readreal(pointprom);
  4799.   if (writingscript)
  4800.     phinprintf(PTKEOUTPUT, "\n");
  4801.   return t;
  4802. }  /* readpoint */
  4803.  
  4804. /*--------------------------------------------------------------------------*/
  4805.  
  4806. static Pvec readvector(C(char *) prom)
  4807. PreANSI(char *prom)
  4808. /*
  4809. ** description: 
  4810. ** input params: 
  4811. ** output params: 
  4812. ** return value: 
  4813. */
  4814. {
  4815.   Pvec t;
  4816.   char pointprom[255];
  4817.  
  4818.   sprintf(pointprom, "%s, x ? ", prom);
  4819.   t.delta_x = readreal(pointprom);
  4820.   sprintf(pointprom, "%s, y ? ", prom);
  4821.   t.delta_y = readreal(pointprom);
  4822.   if (writingscript)
  4823.     phinprintf(PTKEOUTPUT, "\n");
  4824.   return t;
  4825. }  /* readvector */
  4826.  
  4827. /*--------------------------------------------------------------------------*/
  4828.  
  4829. static Plimit readlimit(C(char *) prom)
  4830. PreANSI(char *prom)
  4831. /*
  4832. ** description: 
  4833. ** input params: 
  4834. ** output params: 
  4835. ** return value: 
  4836. */
  4837. {
  4838.   Plimit t;
  4839.   char pointprom[255];
  4840.  
  4841.   sprintf(pointprom, "%s, xmin ? ", prom);
  4842.   t.x_min = readreal(pointprom);
  4843.   sprintf(pointprom, "%s, xmax ? ", prom);
  4844.   t.x_max = readreal(pointprom);
  4845.   sprintf(pointprom, "%s, ymin ? ", prom);
  4846.   t.y_min = readreal(pointprom);
  4847.   sprintf(pointprom, "%s, ymax ? ", prom);
  4848.   t.y_max = readreal(pointprom);
  4849.   if (writingscript)
  4850.     phinprintf(PTKEOUTPUT, "\n");
  4851.   return t;
  4852. }  /* readlimit */
  4853.  
  4854. /*--------------------------------------------------------------------------*/
  4855.  
  4856. static Ppoint3 readpoint3(C(char *) prom)
  4857. PreANSI(char *prom)
  4858. /*
  4859. ** description: 
  4860. ** input params: 
  4861. ** output params: 
  4862. ** return value: 
  4863. */
  4864. {
  4865.   Ppoint3 t;
  4866.   char pointprom[255];
  4867.  
  4868.   sprintf(pointprom, "%s, x ? ", prom);
  4869.   t.x = readreal(pointprom);
  4870.   sprintf(pointprom, "%s, y ? ", prom);
  4871.   t.y = readreal(pointprom);
  4872.   sprintf(pointprom, "%s, z ? ", prom);
  4873.   t.z = readreal(pointprom);
  4874.   if (writingscript)
  4875.     phinprintf(PTKEOUTPUT, "\n");
  4876.   return t;
  4877. }  /* readpoint3 */
  4878.  
  4879. /*--------------------------------------------------------------------------*/
  4880.  
  4881. static Pvec3 readvector3(C(char *) prom)
  4882. PreANSI(char *prom)
  4883. /*
  4884. ** description: 
  4885. ** input params: 
  4886. ** output params: 
  4887. ** return value: 
  4888. */
  4889. {
  4890.   Pvec3 t;
  4891.   char pointprom[255];
  4892.  
  4893.   sprintf(pointprom, "%s, x ? ", prom);
  4894.   t.delta_x = readreal(pointprom);
  4895.   sprintf(pointprom, "%s, y ? ", prom);
  4896.   t.delta_y = readreal(pointprom);
  4897.   sprintf(pointprom, "%s, z ? ", prom);
  4898.   t.delta_z = readreal(pointprom);
  4899.   if (writingscript)
  4900.     phinprintf(PTKEOUTPUT, "\n");
  4901.   return t;
  4902. }  /* readvector3 */
  4903.  
  4904. /*--------------------------------------------------------------------------*/
  4905.  
  4906. static Plimit3 readlimit3(C(char *) prom)
  4907. PreANSI(char *prom)
  4908. {
  4909.   Plimit3 t;
  4910.   char pointprom[255];
  4911.  
  4912.   sprintf(pointprom, "%s, xmin ? ", prom);
  4913.   t.x_min = readreal(pointprom);
  4914.   sprintf(pointprom, "%s, xmax ? ", prom);
  4915.   t.x_max = readreal(pointprom);
  4916.   sprintf(pointprom, "%s, ymin ? ", prom);
  4917.   t.y_min = readreal(pointprom);
  4918.   sprintf(pointprom, "%s, ymax ? ", prom);
  4919.   t.y_max = readreal(pointprom);
  4920.   sprintf(pointprom, "%s, zmin ? ", prom);
  4921.   t.z_min = readreal(pointprom);
  4922.   sprintf(pointprom, "%s, zmax ? ", prom);
  4923.   t.z_max = readreal(pointprom);
  4924.   if (writingscript)
  4925.     phinprintf(PTKEOUTPUT, "\n");
  4926.   return t;
  4927. }  /* readlimit3 */
  4928.  
  4929. /*--------------------------------------------------------------------------*/
  4930.  
  4931. static void readpickpath(C(Ppick_path *) path, C(char *) desc)
  4932. PreANSI(Ppick_path *path)
  4933. PreANSI(char *desc)
  4934. {
  4935.   Pint i;
  4936.   char str[255];
  4937.  
  4938.   sprintf(str, "%s, depth", desc);
  4939.   path->depth = readposinteger(str);
  4940.   path->path_list = (Ppick_path_elem *)calloc(path->depth, 
  4941.                      sizeof(Ppick_path_elem));
  4942.   for (i = 0; i < path->depth; i++)
  4943.   {
  4944.     sprintf(str, "%s, structure identifier [%d]", desc, i);   
  4945.     path->path_list[i].struct_id = readinteger(str);
  4946.     sprintf(str, "%s, pick identifier [%d]", desc, i);   
  4947.     path->path_list[i].pick_id = readinteger(str);
  4948.     sprintf(str, "%s, element number [%d]", desc, i);   
  4949.     path->path_list[i].elem_pos = readinteger(str);
  4950.     if (writingscript)
  4951.       phinprintf(PTKEOUTPUT, "\n");
  4952.   }
  4953. }
  4954.  
  4955. /*--------------------------------------------------------------------------*/
  4956.  
  4957. static void readpointlst(C(Ppoint_list *) plist)
  4958. PreANSI(Ppoint_list *plist)
  4959. /*
  4960. ** description: 
  4961. ** input params: 
  4962. ** output params: 
  4963. ** return value: 
  4964. */
  4965. {
  4966.   Pint i, n;
  4967.   char prom[30];
  4968.  
  4969.   plist->num_points = readposinteger("number of points ? ");
  4970.   plist->points = (Ppoint *)calloc(plist->num_points, sizeof(Ppoint));
  4971.   for (i = 0; i < plist->num_points; i++) 
  4972.   {
  4973.     sprintf(prom, "Point %d", i+1);
  4974.     plist->points[i] = readpoint(prom);
  4975.     if (writingscript)
  4976.       phinprintf(PTKEOUTPUT, "\n");
  4977.   }
  4978. }  /* readpointlst3 */
  4979.  
  4980. /*--------------------------------------------------------------------------*/
  4981.  
  4982. static void readpointlst3(C(Ppoint_list3 *) plist)
  4983. PreANSI(Ppoint_list3 *plist)
  4984. /*
  4985. ** description: 
  4986. ** input params: 
  4987. ** output params: 
  4988. ** return value: 
  4989. */
  4990. {
  4991.   Pint i, n;
  4992.   char prom[30];
  4993.  
  4994.   plist->num_points = readposinteger("number of points ? ");
  4995.   plist->points = (Ppoint3 *)calloc(plist->num_points, sizeof(Ppoint3));
  4996.   for (i = 0; i < plist->num_points; i++) 
  4997.   {
  4998.     sprintf(prom, "Point %d", i+1);
  4999.     plist->points[i] = readpoint3(prom);
  5000.     if (writingscript)
  5001.       phinprintf(PTKEOUTPUT, "\n");
  5002.   }
  5003. }  /* readpointlst3 */
  5004.  
  5005. /*--------------------------------------------------------------------------*/
  5006.  
  5007. static void readpointarray(C(Pint) numpts, C(Ppoint *) plist)
  5008. PreANSI(Pint numpts)
  5009. PreANSI(Ppoint *plist)
  5010. /*
  5011. ** description: 
  5012. ** input params: 
  5013. ** output params: 
  5014. ** return value: 
  5015. */
  5016. {
  5017.   Pint i, n;
  5018.   char prom[30];
  5019.  
  5020.   for (i = 0; i < numpts; i++) 
  5021.   {
  5022.     sprintf(prom, "Point %d", i+1);
  5023.     plist[i] = readpoint(prom);
  5024.     if (writingscript)
  5025.       phinprintf(PTKEOUTPUT, "\n");
  5026.   }
  5027. }  /* readpointarray */
  5028.  
  5029. /*--------------------------------------------------------------------------*/
  5030.  
  5031. static void readpoint3array(C(Pint) numpts, C(Ppoint3 *) plist)
  5032. PreANSI(Pint numpts)
  5033. PreANSI(Ppoint3 *plist)
  5034. /*
  5035. ** description: 
  5036. ** input params: 
  5037. ** output params: 
  5038. ** return value: 
  5039. */
  5040. {
  5041.   Pint i, n;
  5042.   char prom[30];
  5043.  
  5044.   for (i = 0; i < numpts; i++) 
  5045.   {
  5046.     sprintf(prom, "Point %d", i+1);
  5047.     plist[i] = readpoint3(prom);
  5048.     if (writingscript)
  5049.       phinprintf(PTKEOUTPUT, "\n");
  5050.   }
  5051. }  /* readpoint3array */
  5052.  
  5053. /*--------------------------------------------------------------------------*/
  5054.  
  5055. static Pcolr_rep readcolour()
  5056. /*
  5057. ** read a colour representation depending on the current
  5058. ** colour model.
  5059. */
  5060. {
  5061.   Pcolr_rep t;
  5062.  
  5063.   switch (colourmodel)
  5064.   {
  5065.     case PMODEL_RGB: 
  5066.       t.rgb.red = readreal("red ? ");
  5067.       t.rgb.green = readreal("green ? ");
  5068.       t.rgb.blue = readreal("blue ? ");
  5069.       break;
  5070.  
  5071.     case PMODEL_CIELUV: 
  5072.       t.cieluv.cieluv_x = readreal("x coefficient ? ");
  5073.       t.cieluv.cieluv_y = readreal("y coefficient ? ");
  5074.       t.cieluv.cieluv_y_lum = readreal("y luminance ? ");
  5075.       break;
  5076.  
  5077.     case PMODEL_HSV: 
  5078.       t.hsv.hue = readreal("hue ? ");
  5079.       t.hsv.satur = readreal("saturation ? ");
  5080.       t.hsv.value = readreal("value ? ");
  5081.       break;
  5082.  
  5083.     case PMODEL_HLS: 
  5084.       t.hls.hue = readreal("hue ? ");
  5085.       t.hls.lightness = readreal("lightness ? ");
  5086.       t.hls.satur = readreal("saturation ? ");
  5087.       break;
  5088.   }
  5089.   if (writingscript)
  5090.     phinprintf(PTKEOUTPUT, "\n");
  5091.   return t;
  5092. }  /* readcolour */
  5093.  
  5094. /*--------------------------------------------------------------------------*/
  5095.  
  5096. static void readexecreflst(C(Pelem_ref_list *) reflist, C(char *) prom)
  5097. PreANSI(Pelem_ref_list *reflist)
  5098. PreANSI(char *prom)
  5099. {
  5100.   Pint i, num;
  5101.   char prompt[255];
  5102.  
  5103.   sprintf(prompt, "%s, number ? ", prom);
  5104.   reflist->num_elem_refs = readposinteger(prompt);
  5105.   reflist->elem_refs = (Pelem_ref *)calloc(reflist->num_elem_refs,
  5106.                                            sizeof(Pelem_ref));
  5107.   for (i = 0; i < reflist->num_elem_refs; i++)
  5108.   {
  5109.     sprintf(prompt, "%s, execute reference [%d], structure identifier ? ", 
  5110.             prom, i);
  5111.     reflist->elem_refs[i].struct_id = readinteger(prompt);
  5112.     sprintf(prompt, "%s, execute reference [%d], element number ? ", 
  5113.             prom, i);
  5114.     reflist->elem_refs[i].elem_pos = readinteger(prompt);
  5115.     if (writingscript)
  5116.       phinprintf(PTKEOUTPUT, "\n");
  5117.   }  
  5118. }
  5119.  
  5120. /*--------------------------------------------------------------------------*/
  5121.  
  5122. #ifndef HP
  5123. static void readfilterlst(C(Pfilter_list *) filtlist, C(char *) prom)
  5124. PreANSI(Pfilter_list *filtlist)
  5125. PreANSI(char *prom)
  5126. {
  5127.   Pint i, num;
  5128.   char prompt[255];
  5129.  
  5130.   sprintf(prompt, "%s, number of filters ? ", prom);
  5131.   filtlist->num_filters = readposinteger(prompt);
  5132.   filtlist->filters = (Pfilter *)calloc(filtlist->num_filters,
  5133.                                         sizeof(Pfilter));
  5134.   for (i = 0; i < filtlist->num_filters; i++)
  5135.   {
  5136.     sprintf(prompt, "%s, filter [%d], inclusion set, number ? ", prom, i);
  5137.     filtlist->filters[i].incl_set.num_ints = num = readposinteger(prompt);
  5138.     filtlist->filters[i].incl_set.ints = (Pint *)calloc(num, 
  5139.                                                             sizeof(Pint));
  5140.     sprintf(prompt, "%s, filter [%d], inclusion set", prom, i);
  5141.     readintarray(num, filtlist->filters[i].incl_set.ints, prompt,
  5142.                  PTKENAME);
  5143.     sprintf(prompt, "%s, filter [%d], exclusion set, number ? ", prom, i);
  5144.     filtlist->filters[i].excl_set.num_ints = num = readposinteger(prompt);
  5145.     filtlist->filters[i].excl_set.ints = (Pint *)calloc(num, sizeof(Pint));
  5146.     sprintf(prompt, "%s, filter [%d], exclusion set", prom, i);
  5147.     readintarray(num, filtlist->filters[i].excl_set.ints, prompt,
  5148.                  PTKENAME);
  5149.   }  
  5150. }
  5151. #endif
  5152.  
  5153. /*--------------------------------------------------------------------------*/
  5154.  
  5155. static ptkboolean inlist(C(char **) strlist, C(Pint) lenlist, C(char *) str,
  5156.                       C(Pint *) ind) 
  5157. PreANSI(char **strlist)
  5158. PreANSI(Pint lenlist)
  5159. PreANSI(char *str)
  5160. PreANSI(Pint *ind)
  5161. /*
  5162. ** description: searches list of strings for given string.
  5163. ** input params: strlist - pointer to string list.
  5164. ** lenlist - length of string list.
  5165. ** str - string to search.
  5166. ** output params: none.
  5167. ** return value: index of found string, -1 if not found.
  5168. ** special notes: 
  5169. */
  5170. {
  5171.   ptkboolean found;
  5172.   Pint    i;
  5173.  
  5174.   found = FALSE;
  5175.   *ind = -1;
  5176.   i = 0;
  5177.   while ((found == FALSE) && (i < lenlist))
  5178.   {
  5179.     if (strcmp(strlist[i], str) == 0)
  5180.       found = TRUE;
  5181.     else
  5182.       i++;
  5183.   }
  5184.   if (found)
  5185.     *ind = i;
  5186.   return found;
  5187. }  /* inlist */
  5188.  
  5189. /*--------------------------------------------------------------------------*/
  5190.  
  5191. static ptkboolean substrinlist(C(char **) strlist, C(Pint) lenlist, 
  5192.                            C(char *) str, C(Pint *) ind) 
  5193. PreANSI(char **strlist)
  5194. PreANSI(Pint lenlist)
  5195. PreANSI(char *str)
  5196. PreANSI(Pint *ind)
  5197. /*
  5198. ** description: searches list of strings for given string.
  5199. ** input params: strlist - pointer to string list.
  5200. ** lenlist - length of string list.
  5201. ** str - string to search.
  5202. ** output params: none.
  5203. ** return value: index of found string, -1 if not found.
  5204. ** special notes: 
  5205. */
  5206. {
  5207.   ptkboolean found;
  5208.   Pint    i;
  5209.  
  5210.   found = FALSE;
  5211.   *ind = -1;
  5212.   i = 0;
  5213.   while ((found == FALSE) && (i < lenlist))
  5214.   {
  5215.     if (strncmp(strlist[i], str, strlen(str)) == 0)
  5216.       found = TRUE;
  5217.     else
  5218.       i++;
  5219.   }
  5220.   if (found)
  5221.     *ind = i;
  5222.   return found;
  5223. }  /* inlist */
  5224.  
  5225. /*--------------------------------------------------------------------------*/
  5226.  
  5227. static Pint getphigsenum(C(ptkephigsenum) phigsenum, C(char *) enumstring)
  5228. PreANSI(ptkephigsenum phigsenum)
  5229. PreANSI(char *enumstring)
  5230. /*
  5231. ** description: 
  5232. ** input params: 
  5233. ** output params: 
  5234. ** return value: 
  5235. */
  5236. {
  5237.   Pint enumval;
  5238.   ptkboolean found;
  5239.  
  5240.   switch (phigsenum)
  5241.   {
  5242.     case PTKEWSDEP:
  5243.      found = inlist(Pws_dep_indnames, 2, enumstring, &enumval);
  5244.      break;
  5245.  
  5246.     case PTKESYSTEMSTATE:
  5247.      found = inlist(Psys_stnames, 2, enumstring, &enumval);
  5248.      break;
  5249.  
  5250.     case PTKEWSSTATE:
  5251.      found = inlist(Pws_stnames, 2, enumstring, &enumval);
  5252.      break;
  5253.  
  5254.     case PTKESTRUCTSTATE:
  5255.      found = inlist(Pstruct_stnames, 2, enumstring, &enumval);
  5256.      break;
  5257.  
  5258.     case PTKESTRUCTSTATUS:
  5259.      found = inlist(Pstruct_statusnames, 3, enumstring, &enumval);
  5260.      break;
  5261.  
  5262.     case PTKEARCHIVESTATE:
  5263.      found = inlist(Par_stnames, 2, enumstring, &enumval);
  5264.      break;
  5265.  
  5266.     case PTKEWSCLASS:
  5267.      found = inlist(Pws_classnames, 3, enumstring, &enumval);
  5268.      break;
  5269.  
  5270.     case PTKEWSCAT:
  5271.      found = inlist(Pws_catnames, 5, enumstring, &enumval);
  5272.      break;
  5273.  
  5274.     case PTKECONTROL:
  5275.      found = inlist(Pctrl_flagnames, 2, enumstring, &enumval);
  5276.      break;
  5277.  
  5278.     case PTKEREGEN:
  5279.      found = inlist(Pregen_flagnames, 2, enumstring, &enumval);
  5280.      break;
  5281.  
  5282.     case PTKEDEFMODE:
  5283.      found = inlist(Pdefer_modenames, 5, enumstring, &enumval);
  5284.      break;
  5285.  
  5286.     case PTKEMOD:
  5287.      found = inlist(Pmodnames, 3, enumstring, &enumval);
  5288.      break;
  5289.  
  5290.     case PTKESIMULTEV:
  5291.      found = inlist(Psimult_eventsnames, 2, enumstring, &enumval);
  5292.      break;
  5293.  
  5294.     case PTKESTRUCTNETSRC:
  5295.      found = inlist(Pstruct_net_sourcenames, 2, enumstring, &enumval);
  5296.      break;
  5297.  
  5298.     case PTKEDSPSURF:
  5299.      found = inlist(Pdisp_surfnames, 2, enumstring, &enumval);
  5300.      break;
  5301.  
  5302.     case PTKEVISUALREP:
  5303.      found = inlist(Pvisual_stnames, 3, enumstring, &enumval);
  5304.      break;
  5305.  
  5306.     case PTKETXPREC:
  5307.      found = inlist(Ptext_precnames, 3, enumstring, &enumval);
  5308.      break;
  5309.  
  5310.     case PTKETXPATH:
  5311.      found = inlist(Ptext_pathnames, 4, enumstring, &enumval);
  5312.      break;
  5313.  
  5314.     case PTKETXHOR:
  5315.      found = inlist(Phor_alignnames, 4, enumstring, &enumval);
  5316.      break;
  5317.  
  5318.     case PTKETXVER:
  5319.      found = inlist(Pvert_alignnames, 5, enumstring, &enumval);
  5320.      break;
  5321.  
  5322.     case PTKEINTERSTYLE:
  5323.      found = inlist(Pint_stylenames, 5, enumstring, &enumval);
  5324.      break;
  5325.  
  5326.     case PTKEEDGEF:
  5327.      found = inlist(Pedge_flagnames, 2, enumstring, &enumval);
  5328.      break;
  5329.  
  5330.     case PTKEATTRID:
  5331.      found = inlist(Paspectnames, 18, enumstring, &enumval);
  5332.      break;
  5333.  
  5334.     case PTKEASF:
  5335.      found = inlist(Pasfnames, 2, enumstring, &enumval);
  5336.      break;
  5337.  
  5338.     case PTKECOAVAIL:
  5339.      found = inlist(Pcolr_availnames, 2, enumstring, &enumval);
  5340.      break;
  5341.  
  5342.     case PTKECOMPTYPE:
  5343.      found = inlist(Pcompose_typenames, 3, enumstring, &enumval);
  5344.      break;
  5345.  
  5346.     case PTKEPROJTYPE:
  5347.      found = inlist(Pproj_typenames, 2, enumstring, &enumval);
  5348.      break;
  5349.  
  5350.     case PTKECLIP:
  5351.      found = inlist(Pclip_indnames, 2, enumstring, &enumval);
  5352.      break;
  5353.  
  5354.     case PTKEVPRI:
  5355.      found = inlist(Pprinames, 2, enumstring, &enumval);
  5356.      break;
  5357.  
  5358.     case PTKECONFRES:
  5359.      found = inlist(Pconf_resnames, 3, enumstring, &enumval);
  5360.      break;
  5361.  
  5362.     case PTKEPFCF:
  5363.      found = inlist(Ppfcfnames, 3, enumstring, &enumval);
  5364.      break;
  5365.  
  5366.     case PTKEPATHORDER:
  5367.      found = inlist(Ppath_ordernames, 2, enumstring, &enumval);
  5368.      break;
  5369.  
  5370.     case PTKEIMODE:
  5371.      found = inlist(Pop_modenames, 3, enumstring, &enumval);
  5372.      break;
  5373.  
  5374.     case PTKEESW:
  5375.      found = inlist(Pechonames, 2, enumstring, &enumval);
  5376.      break;
  5377.  
  5378.     case PTKEISTATUS:
  5379.      found = inlist(Pistatusnames, 3, enumstring, &enumval);
  5380.      break;
  5381.  
  5382.     case PTKEOPENSTRUCTSTATUS:
  5383.      found = inlist(Popen_struct_statusnames, 2, enumstring, &enumval);
  5384.      break;
  5385.  
  5386.     case PTKEICLASS:
  5387.      found = inlist(Pin_classnames, 7, enumstring, &enumval);
  5388.      break;
  5389.  
  5390.     case PTKEPRF:
  5391.      found = inlist(Pprompt_switchnames, 2, enumstring, &enumval);
  5392.      break;
  5393.  
  5394.     case PTKEINQTYPE:
  5395.      found = inlist(Pinq_typenames, 2, enumstring, &enumval);
  5396.      break;
  5397.  
  5398.     case PTKEUPDATEST:
  5399.      found = inlist(Pupd_stnames, 2, enumstring, &enumval);
  5400.      break;
  5401.  
  5402.     case PTKEDEVUNITS:
  5403.      found = inlist(Pdc_unitsnames, 2, enumstring, &enumval);
  5404.      break;
  5405.  
  5406.     case PTKEMODTYPE:
  5407.      found = inlist(Pdyn_modnames, 3, enumstring, &enumval);
  5408.      break;
  5409.  
  5410.     case PTKEATTRS:
  5411.      found = inlist(Pattrsnames, 5, enumstring, &enumval);
  5412.      break;
  5413.  
  5414.     case PTKEELTYPE:
  5415.      found = inlist(Pelem_typenames, 71, enumstring, &enumval);
  5416.      break;
  5417.  
  5418.     case PTKEEDITMODE:
  5419.      found = inlist(Pedit_modenames, 2, enumstring, &enumval);
  5420.      break;
  5421.  
  5422.     case PTKEREFF:
  5423.      found = inlist(Pref_flagnames, 2, enumstring, &enumval);
  5424.      break;
  5425.  
  5426.     case PTKEERRORMODE:
  5427.      found = inlist(Perr_modenames, 2, enumstring, &enumval);
  5428.      break;
  5429.  
  5430.     case PTKESRCHDIR:
  5431.      found = inlist(Psearch_dirnames, 2, enumstring, &enumval);
  5432.      break;
  5433.  
  5434.     case PTKESRCHSTATUS:
  5435.      found = inlist(Psearch_statusnames, 2, enumstring, &enumval);
  5436.      break;
  5437.  
  5438.     case PTKESRCHELTYPE:
  5439.      found = inlist(Pelem_typenames, 71, enumstring, &enumval);
  5440.      break;
  5441.  
  5442. #ifdef SUN
  5443.     case PTKEBASENAME:
  5444.      found = inlist(Pbasenames, 4, enumstring, &enumval);
  5445.      break;
  5446.  
  5447.     case PTKEWSTYPEATTR:
  5448.      found = inlist(Pwsattrnames, 41, enumstring, &enumval);
  5449.      break;
  5450.  
  5451.     case PTKEDBLBUFF:
  5452.      found = inlist(Pdblbuffnames, 3, enumstring, &enumval);
  5453.      break;
  5454.  
  5455.     case PTKECURSORTYPE:
  5456.      found = inlist(Pcursortypenames, 4, enumstring, &enumval);
  5457.      if (found == 2)
  5458.        found = 3;
  5459.      else
  5460.      if (found == 3)
  5461.        found = 12;
  5462.      break;
  5463.  
  5464.     case PTKEACCUSAGE:
  5465.      found = inlist(Paccusagenames, 11, enumstring, &enumval);
  5466.      break;
  5467.  
  5468.     case PTKECOLOURMODE:
  5469.      found = inlist(Pcolourmodenames, 2, enumstring, &enumval);
  5470.      break;
  5471.  
  5472.     case PTKECGMENCODING:
  5473.      found = inlist(Pcgmencodingnames, 3, enumstring, &enumval);
  5474.      break;
  5475.  
  5476.     case PTKECGMCONFORMANCE:
  5477.      found = inlist(Pcgmconformancenames, 3, enumstring, &enumval);
  5478.      break;
  5479.  
  5480.     case PTKECGMVDCPRECISION:
  5481.      found = inlist(Pcgmvdcprecisionnames, 2, enumstring, &enumval);
  5482.      break;
  5483.  
  5484.     case PTKEBGCLEAR:
  5485.      found = inlist(Pbgclearnames, 2, enumstring, &enumval);
  5486.      break;
  5487.  
  5488.     case PTKEUSEDECOMP:
  5489.      found = inlist(Pdcmpnames, 2, enumstring, &enumval);
  5490.      break;
  5491.  
  5492.     case PTKEDCMODEL:
  5493.      found = inlist(Pdcmodelnames, 2, enumstring, &enumval);
  5494.      break;
  5495.  
  5496.     case PTKESIMULATEPICK:
  5497.      found = inlist(Psimulatepicknames, 2, enumstring, &enumval);
  5498.      break;
  5499. #endif
  5500. #ifdef PEXSI
  5501.     case PTKEBASENAME:
  5502.      found = inlist(Pbasenames, 4, enumstring, &enumval);
  5503.      break;
  5504.  
  5505.     case PTKEWSTYPEATTR:
  5506.      found = inlist(Pwsattrnames, 41, enumstring, &enumval);
  5507.      break;
  5508.  
  5509.     case PTKEDBLBUFF:
  5510.      found = inlist(Pdblbuffnames, 3, enumstring, &enumval);
  5511.      break;
  5512.  
  5513.     case PTKEBGCLEAR:
  5514.      found = inlist(Pbgclearnames, 2, enumstring, &enumval);
  5515.      break;
  5516.  
  5517.     case PTKEDCMODEL:
  5518.      found = inlist(Pdcmodelnames, 2, enumstring, &enumval);
  5519.      break;
  5520. #endif
  5521.  
  5522. /* PHIGS PLUS bits */
  5523. #ifdef SUN
  5524.     case PTKEDCUEMODE:
  5525.      found = inlist(Pdcuemodenames, 2, enumstring, &enumval);
  5526.      break;
  5527.  
  5528.     case PTKERATIONAL:
  5529.      found = inlist(Prationalnames, 2, enumstring, &enumval);
  5530.      break;
  5531.  
  5532.     case PTKECULLMODE:
  5533.      found = inlist(Pcullmodenames, 3, enumstring, &enumval);
  5534.      break;
  5535.  
  5536.     case PTKEDISTINGMODE:
  5537.      found = inlist(Pdistingmodenames, 2, enumstring, &enumval);
  5538.      break;
  5539.  
  5540.     case PTKECURVEPLACE:
  5541.      found = inlist(Pcurveplacenames, 2, enumstring, &enumval);
  5542.      break;
  5543. #endif
  5544.   }
  5545.   return enumval;
  5546. }
  5547.  
  5548. /*--------------------------------------------------------------------------*/
  5549.  
  5550. static Pint readphigsenum(C(ptkephigsenum) phigsenum, C(char *) prom)
  5551. PreANSI(ptkephigsenum phigsenum)
  5552. PreANSI(char *prom)
  5553. {
  5554.   Pint enumval;
  5555.   char enumstring[80];
  5556.  
  5557.   readstring(enumstring, prom);
  5558.   stripstr(enumstring, '"');
  5559.   /* make upper case */
  5560.   strupper(enumstring);
  5561.   enumval = getphigsenum(phigsenum, enumstring);
  5562.   if (writingscript)
  5563.     phinprintf(PTKEOUTPUT, "%s ", enumstring);
  5564.   return enumval;
  5565. }
  5566.  
  5567. /*--------------------------------------------------------------------------*/
  5568.  
  5569. static void readenumlist(C(Pint) length, C(Pint *) enumlist, 
  5570.                          C(ptkephigsenum) enumtype, C(char *) prom)
  5571. PreANSI(Pint length)
  5572. PreANSI(Pint *enumlist)
  5573. PreANSI(ptkephigsenum enumtype)
  5574. PreANSI(char *prom)
  5575. {
  5576.   Pint i;
  5577.   char prompt[255];
  5578.  
  5579.   for (i = 0; i < length; i++)
  5580.   {
  5581.     sprintf(prompt, "%s [%d] ", prom, i);
  5582.     enumlist[i] = readphigsenum(enumtype, prompt);
  5583.     if (writingscript)
  5584.       phinprintf(PTKEOUTPUT, "\n");
  5585.   }
  5586. }
  5587.  
  5588. /*--------------------------------------------------------------------------*/
  5589.  
  5590. static void readwstype(C(Pint *) wstype)
  5591. PreANSI(Pint *wstype)
  5592. {
  5593.   char str[80];
  5594.  
  5595.   readstring(str, "workstation type");
  5596.   stripstr(str, '"');
  5597.   strupper(str);
  5598.   if (writingscript)
  5599.     phinprintf(PTKEOUTPUT, "%s ", str);
  5600.   if ((strncmp(str, "WST", 3) == 0) || (strncmp(str, "WS", 2) == 0))
  5601.     *wstype = wst;
  5602.   else
  5603. #ifdef SUN
  5604.   {
  5605.     Phigs_base_name base;
  5606.  
  5607.     base = getphigsenum(PTKEBASENAME, str);
  5608.     switch (base)
  5609.     {
  5610.       case PHIGS_X_TOOL: 
  5611.         *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
  5612.         break;
  5613.  
  5614.       case PHIGS_X_DRAWABLE: 
  5615.         *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable, 0);
  5616.         break;
  5617.  
  5618.       case PHIGS_CGM_OUT: 
  5619.         *wstype = phigs_ws_type_create(phigs_ws_type_cgm_out, 0);
  5620.         break;
  5621.  
  5622.       case PHIGS_X_DRAWABLE_REGION: 
  5623.         *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable_region, 0);
  5624.         break;
  5625.  
  5626.       default:
  5627.         *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
  5628.         break;
  5629.     }
  5630.   }
  5631. #endif
  5632. #ifdef PEXSI
  5633.   {
  5634.     Phigs_base_name base;
  5635.  
  5636.     base = getphigsenum(PTKEBASENAME, str);
  5637.     switch (base)
  5638.     {
  5639.       case PHIGS_X_TOOL: 
  5640.         *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, NULL);
  5641.         break;
  5642.  
  5643.       case PHIGS_X_DRAWABLE: 
  5644.         *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable, NULL);
  5645.         break;
  5646.  
  5647.       default: 
  5648.         *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, NULL);
  5649.         break;
  5650.     }
  5651.   }
  5652. #endif
  5653. #ifdef VMS
  5654.   {
  5655.     Pint wsint;
  5656.   
  5657.     wsint = atoi(str);
  5658.     *wstype = wsint;
  5659.   }
  5660. #endif
  5661. #ifdef HP
  5662.   {
  5663.     Pint wsint;
  5664.   
  5665.     wsint = atoi(str);
  5666.     *wstype = wsint;
  5667.   }
  5668. #endif
  5669. }
  5670.  
  5671. /*--------------------------------------------------------------------------*/
  5672.  
  5673. static void readlnbundl(C(Pline_bundle *) bundl)
  5674. PreANSI(Pline_bundle *bundl)
  5675. {
  5676.   bundl->type = readinteger("linetype");
  5677.   bundl->width = readreal("linewidth scale factor");
  5678.   bundl->colr_ind = readposintvalue("line colour index", PTKECOLOURIND);
  5679. }
  5680.  
  5681. /*--------------------------------------------------------------------------*/
  5682.  
  5683. static void readmkbundl(C(Pmarker_bundle *) bundl)
  5684. PreANSI(Pmarker_bundle *bundl)
  5685. {
  5686.   bundl->type = readinteger("marker type");
  5687.   bundl->size = readreal("marker size scale factor");
  5688.   bundl->colr_ind = readposintvalue("marker colour index", PTKECOLOURIND);
  5689. }
  5690.  
  5691. /*--------------------------------------------------------------------------*/
  5692.  
  5693. static void readtxbundl(C(Ptext_bundle *) bundl)
  5694. PreANSI(Ptext_bundle *bundl)
  5695. {
  5696.   bundl->font = readinteger("text font");
  5697.   bundl->prec = readphigsenum(PTKETXPREC, "text precision");
  5698.   bundl->char_expan = readreal("character expansion factor");
  5699.   bundl->char_space = readreal("character spacing");
  5700.   bundl->colr_ind = readposintvalue("text colour index", PTKECOLOURIND);
  5701. }
  5702.  
  5703. /*--------------------------------------------------------------------------*/
  5704.  
  5705. static void readinterbundl(C(Pint_bundle *) bundl)
  5706. PreANSI(Pint_bundle *bundl)
  5707. {
  5708.   bundl->style = readphigsenum(PTKEINTERSTYLE, "interior style");
  5709.   bundl->style_ind = readinteger("interior style index");
  5710.   bundl->colr_ind = readposintvalue("interior colour index", PTKECOLOURIND);
  5711. }
  5712.  
  5713. /*--------------------------------------------------------------------------*/
  5714.  
  5715. static void readedgebundl(C(Pedge_bundle *) bundl)
  5716. PreANSI(Pedge_bundle *bundl)
  5717. {
  5718.   bundl->flag = readphigsenum(PTKEEDGEF, "edge flag");
  5719.   bundl->type = readinteger("edgetype");
  5720.   bundl->width = readreal("edgewidth scale factor");
  5721.   bundl->colr_ind = readposintvalue("edge colour index", PTKECOLOURIND);
  5722. }
  5723.  
  5724. /*--------------------------------------------------------------------------*/
  5725.  
  5726. static void readlnattr(C(Pline_attrs *) attr)
  5727. PreANSI(Pline_attrs *attr)
  5728. {
  5729.   attr->type_asf = readphigsenum(PTKEASF, "linetype asf");  
  5730.   attr->width_asf = readphigsenum(PTKEASF, "line width asf");  
  5731.   attr->colr_ind_asf = readphigsenum(PTKEASF, "line colour asf");
  5732.   attr->ind = readposinteger("line index");
  5733.   readlnbundl(&attr->bundle);  
  5734. }
  5735.  
  5736. /*--------------------------------------------------------------------------*/
  5737.  
  5738. static void readinterattr(C(Pint_attrs *) attr)
  5739. PreANSI(Pint_attrs *attr)
  5740. {
  5741.   attr->style_asf = readphigsenum(PTKEASF, "interior asf");  
  5742.   attr->style_ind_asf = readphigsenum(PTKEASF, "interior style asf");  
  5743.   attr->colr_ind_asf = readphigsenum(PTKEASF, "interior colour asf");
  5744.   attr->ind = readposinteger("interior index");
  5745.   readinterbundl(&attr->bundle);  
  5746. }
  5747.  
  5748. /*--------------------------------------------------------------------------*/
  5749.  
  5750. static void readedgeattr(C(Pedge_attrs *) attr)
  5751. PreANSI(Pedge_attrs *attr)
  5752. {
  5753.   attr->flag_asf = readphigsenum(PTKEASF, "edge flag asf");  
  5754.   attr->width_asf = readphigsenum(PTKEASF, "edge width asf");  
  5755.   attr->colr_ind_asf = readphigsenum(PTKEASF, "edge colour asf");
  5756.   attr->ind = readposinteger("edge index");
  5757.   readedgebundl(&attr->bundle);  
  5758. }
  5759.  
  5760. /*--------------------------------------------------------------------------*/
  5761.  
  5762. static void readmkattr(C(Pmarker_attrs *) attr)
  5763. PreANSI(Pmarker_attrs *attr)
  5764. {
  5765.   attr->type_asf = readphigsenum(PTKEASF, "marker type asf");  
  5766.   attr->size_asf = readphigsenum(PTKEASF, "marker size asf");  
  5767.   attr->colr_ind_asf = readphigsenum(PTKEASF, "marker colour asf");
  5768.   attr->ind = readposinteger("marker index");
  5769.   readmkbundl(&attr->bundle);  
  5770. }
  5771.  
  5772. /*--------------------------------------------------------------------------*/
  5773.  
  5774. static void readchoicerec(C(Pint) device, C(Pint) pet, C(Pchoice_data *) rec)
  5775. PreANSI(Pint device)
  5776. PreANSI(Pint pet)
  5777. PreANSI(Pchoice_data *rec)
  5778. {
  5779.   /* Implementation dependent code */
  5780. #ifdef SUN
  5781.   switch (device)
  5782.   {
  5783.     case 1: 
  5784.     case 2:
  5785.     case 3: 
  5786.       switch (pet)
  5787.       {
  5788.         case 1:
  5789.           break;
  5790.  
  5791.         case 3:
  5792.           {
  5793.             Pint i, len;
  5794.             char **chstrings;
  5795.  
  5796.             rec->pets.pet_r3.num_strings = 
  5797.               readposinteger("number of choice strings ? ");
  5798.             chstrings = (char **)calloc(rec->pets.pet_r3.num_strings,
  5799.                                          sizeof(char *));
  5800.             rec->pets.pet_r3.strings = chstrings;
  5801.             for (i = 0; i < rec->pets.pet_r3.num_strings; i++)
  5802.         {
  5803.               len = readposinteger("choice string length ? ");
  5804.               chstrings[i] = (char *)calloc(len, sizeof(char));    
  5805.               readquote(chstrings[i], "choice string ? ");
  5806.             }
  5807.           }
  5808.           break;
  5809.       }
  5810.       break;
  5811.  
  5812.     default: break;
  5813.   }
  5814. #endif
  5815. #ifdef HP
  5816.   switch (device)
  5817.   {
  5818.     case 1: 
  5819.       break;
  5820.  
  5821.     default: break;
  5822.   }
  5823. #endif
  5824. }  /* readchoicerec */
  5825.  
  5826. /*--------------------------------------------------------------------------*/
  5827.  
  5828. static void readchoicerec3(C(Pint) device, C(Pint) pet, 
  5829.                            C(Pchoice_data3 *) rec)
  5830. PreANSI(Pint device)
  5831. PreANSI(Pint pet)
  5832. PreANSI(Pchoice_data3 *rec)
  5833. {
  5834.   /* Implementation dependent code */
  5835. #ifdef SUN
  5836.   readchoicerec(device, pet, (Pchoice_data *)rec);
  5837. #endif
  5838. #ifdef HP
  5839.   readchoicerec(device, pet, (Pchoice_data *)rec);
  5840. #endif
  5841. }  /* readchoicerec3 */
  5842.  
  5843. /*--------------------------------------------------------------------------*/
  5844.  
  5845. static void readlocrec(C(Pint) device, C(Pint) pet, C(Ploc_data *) rec)
  5846. PreANSI(Pint device)
  5847. PreANSI(Pint pet)
  5848. PreANSI(Ploc_data *rec)
  5849. {
  5850.   Pint i;
  5851.  
  5852.   /* Implementation dependent code */
  5853. #ifdef SUN
  5854.   switch (device)
  5855.   {
  5856.     case 1: 
  5857.     case 2:
  5858.     case 3: 
  5859.     case 4:
  5860.     case 5:
  5861.       switch (pet)
  5862.       {
  5863.         case 1:
  5864.         case 2:
  5865.         case 3:
  5866.           break;
  5867.  
  5868.         case -2:
  5869.           rec->pets.pet_u2.crosshair_colr =
  5870.             readposintvalue("crosshair colour index ? ", PTKECOLOURIND);
  5871.           break;
  5872.  
  5873.         case -4:
  5874.           readlnbundl(&rec->pets.pet_u4.line_bundle);
  5875.           break;
  5876.  
  5877.         case -5:
  5878.           readlnbundl(&rec->pets.pet_u5.line_bundle);
  5879.           break;
  5880.       }
  5881.  
  5882.     default: break;
  5883.   }
  5884. #endif
  5885. #ifdef HP
  5886.   switch (device)
  5887.   {
  5888.     case 1: 
  5889.     case 2:
  5890.     case 3: 
  5891.     case 4:
  5892.       switch (pet)
  5893.       {
  5894.         case 1:
  5895.           rec->pets.pet_r1.loc_colr_ind = 
  5896.             readposintvalue("locator colour index ? ", PTKECOLOURIND);       
  5897.           break;
  5898.  
  5899.         case 2:
  5900.           rec->pets.pet_r2.loc_colr_ind = 
  5901.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5902.           break;
  5903.  
  5904.         case 3:
  5905.           rec->pets.pet_r3.loc_colr_ind = 
  5906.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5907.           break;
  5908.  
  5909.         case 4:
  5910.           readlnattr(&rec->pets.pet_r4.line_attrs);
  5911.           break;
  5912.  
  5913.         case 5:
  5914.           rec->pets.pet_r5.line_fill_ctrl_flag = 
  5915.             readphigsenum(PTKECONTROL, "polyline/fill area control flag ? ");
  5916.           switch (rec->pets.pet_r5.line_fill_ctrl_flag)
  5917.       {
  5918.             case PFLAG_LINE:
  5919.               readlnattr(&rec->pets.pet_r5.attrs.line_attrs);
  5920.               break;
  5921.  
  5922.             case PFLAG_FILL:
  5923.               readinterattr(&rec->pets.pet_r5.attrs.int_attrs);
  5924.               break;
  5925.  
  5926.             case PFLAG_FILL_SET:
  5927.               readinterattr(&rec->pets.pet_r5.attrs.fill_set.int_attrs);
  5928.               readedgeattr(&rec->pets.pet_r5.attrs.fill_set.edge_attrs);
  5929.               break;
  5930.           }
  5931.           break;
  5932.  
  5933.         case 6:
  5934.           rec->pets.pet_r6.loc_colr_ind = 
  5935.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5936.           break;
  5937.  
  5938.         case -1:
  5939.           rec->pets.pet_u1.loc_colr_ind = 
  5940.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5941.           rec->pets.pet_u1.rect_height = readreal("rectangle height ? "); 
  5942.           rec->pets.pet_u1.rect_width = readreal("rectangle width ? "); 
  5943.           break;
  5944.  
  5945.         case -2:
  5946.           rec->pets.pet_u2.loc_colr_ind = 
  5947.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5948.           rec->pets.pet_u2.attach_point = readpoint3("attachment point");
  5949.           rec->pets.pet_u2.num_point_lists = 
  5950.             readposinteger("number of point lists ? ");
  5951.           rec->pets.pet_u2.point_lists = 
  5952.             (Ppoint_list *)calloc(rec->pets.pet_u2.num_point_lists,
  5953.                                   sizeof(Ppoint_list));
  5954.           for (i = 0; i < rec->pets.pet_u2.num_point_lists; i++)
  5955.             readpointlst3(&rec->pets.pet_u2.point_lists[i]);
  5956.           break;
  5957.  
  5958.         case -3:
  5959.           rec->pets.pet_u3.loc_colr_ind = 
  5960.             readposintvalue("locator colour index ? ", PTKECOLOURIND);
  5961.           rec->pets.pet_u3.struct_id = 
  5962.             readintvalue("structure identifier ? ", PTKESTRUCTID);
  5963.           rec->pets.pet_u3.attach_point = readpoint3("attachment point");
  5964.           break;
  5965.       }
  5966.  
  5967.     default: break;
  5968.   }
  5969. #endif
  5970. }  /* readlocrec */
  5971.  
  5972. /*--------------------------------------------------------------------------*/
  5973.  
  5974. static void readlocrec3(C(Pint) device, C(Pint) pet, C(Ploc_data3 *) rec)
  5975. PreANSI(Pint device)
  5976. PreANSI(Pint pet)
  5977. PreANSI(Ploc_data3 *rec)
  5978. {
  5979.   /* Implementation dependent code */
  5980. #ifdef SUN
  5981.   readlocrec(device, pet, (Ploc_data *)rec);
  5982. #endif
  5983. #ifdef HP
  5984.   readlocrec(device, pet, (Ploc_data *)rec);
  5985. #endif
  5986. }  /* readlocrec3 */
  5987.  
  5988. /*--------------------------------------------------------------------------*/
  5989.  
  5990. static void readpickrec(C(Pint) device, C(Pint) pet, C(Ppick_data *) rec)
  5991. PreANSI(Pint device)
  5992. PreANSI(Pint pet)
  5993. PreANSI(Ppick_data *rec)
  5994. {
  5995.   /* Implementation dependent code */
  5996. #ifdef SUN
  5997.   switch (device)
  5998.   {
  5999.     case 1: 
  6000.     case 2:
  6001.     case 3: 
  6002.     case 4:
  6003.     case 5:
  6004.     case 6:
  6005.       switch (pet)
  6006.       {
  6007.         case 1:
  6008.           break;
  6009.  
  6010.         case 2:
  6011.           rec->pets.pet_r2.highl_colr = 
  6012.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6013.           rec->pets.pet_r2.highl_count = 
  6014.             readinteger("number of times to blink ? ");
  6015.           rec->pets.pet_r2.highl_duration = 
  6016.             readinteger("number of seconds per half blink ? ");
  6017.           rec->pets.pet_r2.ap_size = readreal("aperture size ? ");          
  6018.           break;
  6019.  
  6020.         case 3:
  6021.           rec->pets.pet_r3.highl_colr = 
  6022.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6023.           rec->pets.pet_r3.highl_count = 
  6024.             readposinteger("number of times to blink ? ");
  6025.           rec->pets.pet_r3.highl_duration = 
  6026.             readposinteger("number of seconds per half blink ? ");
  6027.           rec->pets.pet_r3.ap_size = readreal("aperture size ? ");          
  6028.           break;
  6029.  
  6030.         case -1:
  6031.           rec->pets.pet_u1.highl_colr = 
  6032.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6033.           rec->pets.pet_u1.highl_count = 
  6034.             readposinteger("number of times to blink ? ");
  6035.           rec->pets.pet_u1.highl_duration = 
  6036.             readposinteger("number of seconds per half blink ? ");
  6037.           rec->pets.pet_u1.ap_size = readreal("aperture size ? ");          
  6038.           break;
  6039.  
  6040.         case -2:
  6041.           rec->pets.pet_u2.highl_colr = 
  6042.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6043.           rec->pets.pet_u2.highl_count = 
  6044.             readposinteger("number of times to blink ? ");
  6045.           rec->pets.pet_u2.highl_duration = 
  6046.             readposinteger("number of seconds per half blink ? ");
  6047.           rec->pets.pet_u2.ap_size = readreal("aperture size ? ");          
  6048.           break;
  6049.  
  6050.         case -3:
  6051.           rec->pets.pet_u3.highl_colr = 
  6052.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6053.           rec->pets.pet_u3.highl_count = 
  6054.             readposinteger("number of times to blink ? ");
  6055.           rec->pets.pet_u3.highl_duration = 
  6056.             readposinteger("number of seconds per half blink ? ");
  6057.           rec->pets.pet_u3.ap_size = readreal("aperture size ? ");          
  6058.           break;
  6059.  
  6060.         case -4:
  6061.           rec->pets.pet_u4.highl_colr = 
  6062.             readposintvalue("highlight colour index ? ", PTKECOLOURIND);
  6063.           rec->pets.pet_u4.highl_count = 
  6064.             readposinteger("number of times to blink ? ");
  6065.           rec->pets.pet_u4.highl_duration = 
  6066.             readposinteger("number of seconds per half blink ? ");
  6067.           rec->pets.pet_u4.ap_size = readreal("aperture size ? ");          
  6068.           break;
  6069.       }
  6070.  
  6071.     default: break;
  6072.   }
  6073. #endif
  6074. #ifdef HP
  6075.   switch (device)
  6076.   {
  6077.     case 1: 
  6078.     case 2:
  6079.     case 3: 
  6080.       switch (pet)
  6081.       {
  6082.         case 1:
  6083.           rec->pets.pet_r1.highl_colr_ind = 
  6084.             readintvalue("highlight colour index ? ", PTKECOLOURIND);  
  6085.           rec->pets.pet_r1.x_dim = readreal("X dimension of aperture ? ");
  6086.           rec->pets.pet_r1.y_dim = readreal("Y dimension of aperture ? ");
  6087.           rec->pets.pet_r1.z_dim = readreal("Z dimension of aperture ? ");
  6088.           break;
  6089.  
  6090.         case 2:
  6091.           rec->pets.pet_r2.highl_colr_ind = 
  6092.             readintvalue("highlight colour index ? ", PTKECOLOURIND);  
  6093.           rec->pets.pet_r2.x_dim = readreal("X dimension of aperture ? ");
  6094.           rec->pets.pet_r2.y_dim = readreal("Y dimension of aperture ? ");
  6095.           rec->pets.pet_r2.z_dim = readreal("Z dimension of aperture ? ");
  6096.           break;
  6097.  
  6098.         case 3:
  6099.           rec->pets.pet_r3.highl_colr_ind = 
  6100.             readintvalue("highlight colour index ? ", PTKECOLOURIND);  
  6101.           rec->pets.pet_r3.x_dim = readreal("X dimension of aperture ? ");
  6102.           rec->pets.pet_r3.y_dim = readreal("Y dimension of aperture ? ");
  6103.           rec->pets.pet_r3.z_dim = readreal("Z dimension of aperture ? ");
  6104.           break;
  6105.       }
  6106.  
  6107.     default: break;
  6108.   }
  6109. #endif
  6110. }  /* readpickrec */
  6111.  
  6112. /*--------------------------------------------------------------------------*/
  6113.  
  6114. static void readpickrec3(C(Pint) device, C(Pint) pet, C(Ppick_data3 *) rec)
  6115. PreANSI(Pint device)
  6116. PreANSI(Pint pet)
  6117. PreANSI(Ppick_data3 *rec)
  6118. {
  6119.   /* Implementation dependent code */
  6120. #ifdef SUN
  6121.   readpickrec(device, pet, (Ppick_data *)rec);
  6122. #endif
  6123. #ifdef HP
  6124.   readpickrec(device, pet, (Ppick_data *)rec);
  6125. #endif
  6126. }  /* readpickrec3 */
  6127.  
  6128. /*--------------------------------------------------------------------------*/
  6129.  
  6130. static void readstringrec(C(Pint) device, C(Pint) pet, C(Pstring_data *) rec)
  6131. PreANSI(Pint device)
  6132. PreANSI(Pint pet)
  6133. PreANSI(Pstring_data *rec)
  6134. {
  6135.   /* Implementation dependent code */
  6136. #ifdef SUN
  6137.   switch (device)
  6138.   {
  6139.     case 1: 
  6140.       switch (pet)
  6141.       {
  6142.         case 1:
  6143.           rec->in_buf_size = readposinteger("buffer size ? ");
  6144.           rec->init_pos = readposinteger("initial position ? ");
  6145.           break;
  6146.       }
  6147.  
  6148.     default: break;
  6149.   }
  6150. #endif
  6151. #ifdef HP
  6152.   switch (device)
  6153.   {
  6154.     case 1: 
  6155.       rec->in_buf_size = readposinteger("buffer size ? ");
  6156.       rec->init_pos = readposinteger("initial position ? ");
  6157.       switch (pet)
  6158.       {
  6159.         case 1:
  6160.           rec->pets.pet_r1.text_colr_ind = 
  6161.             readposintvalue("text colour index ? ", PTKECOLOURIND);
  6162.           break;
  6163.       }
  6164.  
  6165.     default: break;
  6166.   }
  6167. #endif
  6168. }  /* readstringrec */
  6169.  
  6170. /*--------------------------------------------------------------------------*/
  6171.  
  6172. static void readstringrec3(C(Pint) device, C(Pint) pet, 
  6173.                            C(Pstring_data3 *) rec)
  6174. PreANSI(Pint device)
  6175. PreANSI(Pint pet)
  6176. PreANSI(Pstring_data3 *rec)
  6177. {
  6178.   /* Implementation dependent code */
  6179. #ifdef SUN
  6180.   readstringrec(device, pet, (Pstring_data *)rec);
  6181. #endif
  6182. #ifdef HP
  6183.   readstringrec(device, pet, (Pstring_data *)rec);
  6184. #endif
  6185. }  /* readstringrec3 */
  6186.  
  6187. /*--------------------------------------------------------------------------*/
  6188.  
  6189. static void readstrokerec(C(Pint) device, C(Pint) pet, C(Pstroke_data *) rec)
  6190. PreANSI(Pint device)
  6191. PreANSI(Pint pet)
  6192. PreANSI(Pstroke_data *rec)
  6193. {
  6194.   /* Implementation dependent code */
  6195. #ifdef SUN
  6196.   switch (device)
  6197.   {
  6198.     case 1: 
  6199.     case 2:
  6200.     case 3:
  6201.       rec->in_buf_size = readposinteger("buffer size ? ");
  6202.       rec->init_pos = readposinteger("initial editing position ? ");
  6203.       rec->x_interval = readreal("x interval ? ");
  6204.       rec->y_interval = readreal("y interval ? ");
  6205.       rec->time_interval = readreal("time interval ? ");
  6206.       switch (pet)
  6207.       {
  6208.         case 1:
  6209.           break;
  6210.  
  6211.         case -3:
  6212.           readmkbundl(&rec->pets.pet_u3.marker_bundle);
  6213.           break;          
  6214.  
  6215.         case -4:
  6216.           readlnbundl(&rec->pets.pet_u4.line_bundle);
  6217.           break;          
  6218.       }
  6219.  
  6220.     default: break;
  6221.   }
  6222. #endif
  6223. #ifdef HP
  6224.   switch (device)
  6225.   {
  6226.     case 1: 
  6227.     case 2:
  6228.       rec->in_buf_size = readposinteger("buffer size ? ");
  6229.       rec->init_pos = readposinteger("initial editing position ? ");
  6230.       rec->x_interval = readreal("x interval ? ");
  6231.       rec->y_interval = readreal("y interval ? ");
  6232.       rec->time_interval = readreal("time interval ? ");
  6233.       switch (pet)
  6234.       {
  6235.         case 1:
  6236.           readlnattr(&rec->pets.pet_r1.line_attrs);
  6237.           break;
  6238.  
  6239.         case 2:
  6240.           break;
  6241.  
  6242.         case 3:
  6243.           readmkattr(&rec->pets.pet_r3.marker_attrs);
  6244.           break;          
  6245.  
  6246.         case 4:
  6247.           readlnattr(&rec->pets.pet_r4.line_attrs);
  6248.           break;          
  6249.       }
  6250.  
  6251.     default: break;
  6252.   }
  6253. #endif
  6254. }  /* readstrokerec */
  6255.  
  6256. /*--------------------------------------------------------------------------*/
  6257.  
  6258. static void readstrokerec3(C(Pint) device, C(Pint) pet, 
  6259.                            C(Pstroke_data3 *) rec)
  6260. PreANSI(Pint device)
  6261. PreANSI(Pint pet)
  6262. PreANSI(Pstroke_data3 *rec)
  6263. {
  6264.   /* Implementation dependent code */
  6265. #ifdef SUN
  6266.   switch (device)
  6267.   {
  6268.     case 1: 
  6269.     case 2:
  6270.     case 3:
  6271.       rec->in_buf_size = readposinteger("buffer size ? ");
  6272.       rec->init_pos = readposinteger("initial editing position ? ");
  6273.       rec->x_interval = readreal("x interval ? ");
  6274.       rec->y_interval = readreal("y interval ? ");
  6275.       rec->z_interval = readreal("z interval ? ");
  6276.       rec->time_interval = readreal("time interval ? ");
  6277.       switch (pet)
  6278.       {
  6279.         case 1:
  6280.           break;
  6281.  
  6282.         case -3:
  6283.           readmkbundl(&rec->pets.pet_u3.marker_bundle);
  6284.           break;          
  6285.  
  6286.         case -4:
  6287.           readlnbundl(&rec->pets.pet_u4.line_bundle);
  6288.           break;          
  6289.       }
  6290.  
  6291.     default: break;
  6292.   }
  6293. #endif
  6294. #ifdef HP
  6295.   switch (device)
  6296.   {
  6297.     case 1: 
  6298.     case 2:
  6299.       rec->in_buf_size = readposinteger("buffer size ? ");
  6300.       rec->init_pos = readposinteger("initial editing position ? ");
  6301.       rec->x_interval = readreal("x interval ? ");
  6302.       rec->y_interval = readreal("y interval ? ");
  6303.       rec->z_interval = readreal("z interval ? ");
  6304.       rec->time_interval = readreal("time interval ? ");
  6305.       switch (pet)
  6306.       {
  6307.         case 1:
  6308.           readlnattr(&rec->pets.pet_r1.line_attrs);
  6309.           break;
  6310.  
  6311.         case 2:
  6312.           break;
  6313.  
  6314.         case 3:
  6315.           readmkattr(&rec->pets.pet_r3.marker_attrs);
  6316.           break;          
  6317.  
  6318.         case 4:
  6319.           readlnattr(&rec->pets.pet_r4.line_attrs);
  6320.           break;          
  6321.       }
  6322.  
  6323.     default: break;
  6324.   }
  6325. #endif
  6326. }  /* readstrokerec3 */
  6327.  
  6328. /*--------------------------------------------------------------------------*/
  6329.  
  6330. static void readvalrec(C(Pint) device, C(Pint) pet, C(Pval_data *) rec)
  6331. PreANSI(Pint device)
  6332. PreANSI(Pint pet)
  6333. PreANSI(Pval_data *rec)
  6334. {
  6335.   Pint len;
  6336.  
  6337.   /* Implementation dependent code */
  6338. #ifdef SUN
  6339.   switch (device)
  6340.   {
  6341.     case 1: 
  6342.     case 2:
  6343.     case 3:
  6344.     case 4:
  6345.     case 5:
  6346.     case 6:
  6347.     case 7:
  6348.     case 8:
  6349.     case 9:
  6350.     case 10:
  6351.       rec->low = readreal("low limit ? ");
  6352.       rec->high = readreal("high limit ? ");
  6353.       switch (pet)
  6354.       {
  6355.         case 1:
  6356.           break;
  6357.  
  6358.         case -1:
  6359.           rec->pets.pet_u1.label = (char *)malloc(80);
  6360.           readstring(rec->pets.pet_u1.label, "label ? ");
  6361.           rec->pets.pet_u1.format = (char *)malloc(80);
  6362.           readstring(rec->pets.pet_u1.format, "format ? ");
  6363.           rec->pets.pet_u1.low_label = (char *)malloc(80);
  6364.           readstring(rec->pets.pet_u1.low_label, "low label ? ");
  6365.           rec->pets.pet_u1.high_label = (char *)malloc(80);
  6366.           readstring(rec->pets.pet_u1.high_label, "high label ? ");
  6367.           break;          
  6368.       }
  6369.  
  6370.     default: break;
  6371.   }
  6372. #endif
  6373. #ifdef HP
  6374.   switch (device)
  6375.   {
  6376.     case 10: 
  6377.     case 11:
  6378.     case 12:
  6379.     case 13:
  6380.     case 14:
  6381.     case 15:
  6382.     case 16:
  6383.     case 17:
  6384.     case 18:
  6385.       rec->low_value = readreal("low limit ? ");
  6386.       rec->high_value = readreal("high limit ? ");
  6387.       switch (pet)
  6388.       {
  6389.         case 1:
  6390.           rec->pets.pet_r1.slider_colr_ind = 
  6391.             readposintvalue("slider outline colour index ? ", PTKECOLOURIND);
  6392.           break;
  6393.       }
  6394.  
  6395.     default: break;
  6396.   }
  6397. #endif
  6398. }  /* readvalrec */
  6399.  
  6400. /*--------------------------------------------------------------------------*/
  6401.  
  6402. static void readvalrec3(C(Pint) device, C(Pint) pet, C(Pval_data3 *) rec)
  6403. PreANSI(Pint device)
  6404. PreANSI(Pint pet)
  6405. PreANSI(Pval_data3 *rec)
  6406. {
  6407.   /* Implementation dependent code */
  6408. #ifdef SUN
  6409.   readvalrec(device, pet, (Pval_data *)rec);
  6410. #endif
  6411. #ifdef HP
  6412.   readvalrec(device, pet, (Pval_data *)rec);
  6413. #endif
  6414. }  /* readvalrec3 */
  6415.  
  6416. /*--------------------------------------------------------------------------*/
  6417. /*------------------- PHIGS PLUS read functions ----------------------------*/
  6418. /*--------------------------------------------------------------------------*/
  6419.  
  6420. #ifdef SUN
  6421. static void readdirectcolour(C(Pint) colrmodel, C(Pcoval *) colour,
  6422.                              C(char *) prom)
  6423. PreANSI(Pint colrmodel)
  6424. PreANSI(Pcoval *colour)
  6425. PreANSI(char *prom)
  6426. /*
  6427. ** read a direct colour representation.
  6428. */
  6429. {
  6430.   char prompt[255];
  6431.  
  6432.   switch (colrmodel)
  6433.   {
  6434.     case PMODEL_RGB: 
  6435.       sprintf(prompt, "%s, red ? ", prom);
  6436.       colour->direct.rgb.red = readreal(prompt);
  6437.       sprintf(prompt, "%s, green ? ", prom);
  6438.       colour->direct.rgb.green = readreal(prompt);
  6439.       sprintf(prompt, "%s, blue ? ", prom);
  6440.       colour->direct.rgb.blue = readreal(prompt);
  6441.       break;
  6442.  
  6443.     case PMODEL_CIELUV: 
  6444.       sprintf(prompt, "%s, x coefficient ? ", prom);
  6445.       colour->direct.cieluv.cieluv_x = readreal(prompt);
  6446.       sprintf(prompt, "%s, y coefficient ? ", prom);
  6447.       colour->direct.cieluv.cieluv_y = readreal(prompt);
  6448.       sprintf(prompt, "%s, y luminance ? ", prom);
  6449.       colour->direct.cieluv.cieluv_y_lum = readreal(prompt);
  6450.       break;
  6451.  
  6452.     case PMODEL_HSV: 
  6453.       sprintf(prompt, "%s, hue ? ", prom);
  6454.       colour->direct.hsv.hue = readreal(prompt);
  6455.       sprintf(prompt, "%s, saturation ? ", prom);
  6456.       colour->direct.hsv.satur = readreal(prompt);
  6457.       sprintf(prompt, "%s, value ? ", prom);
  6458.       colour->direct.hsv.value = readreal(prompt);
  6459.       break;
  6460.  
  6461.     case PMODEL_HLS: 
  6462.       sprintf(prompt, "%s, hue ? ", prom);
  6463.       colour->direct.hls.hue = readreal(prompt);
  6464.       sprintf(prompt, "%s, lightness ? ", prom);
  6465.       colour->direct.hls.lightness = readreal(prompt);
  6466.       sprintf(prompt, "%s, saturation ? ", prom);
  6467.       colour->direct.hls.satur = readreal(prompt);
  6468.       break;
  6469.   }
  6470.   if (writingscript)
  6471.     phinprintf(PTKEOUTPUT, "\n");
  6472. }  /* readdirectcolour */
  6473.  
  6474. /*--------------------------------------------------------------------------*/
  6475.  
  6476. static void readgcolr(C(Pgcolr *) colour, C(char *) prom)
  6477. PreANSI(Pgcolr *colour)
  6478. PreANSI(char *prom)
  6479. /*
  6480. ** read a general colour representation.
  6481. */
  6482. {
  6483.   char prompt[80];
  6484.  
  6485.   sprintf(prompt, "%s, colour type ? ", prom);
  6486.   colour->type = readinteger(prompt);
  6487.   switch (colour->type)
  6488.   {
  6489.     case PINDIRECT:
  6490.       sprintf(prompt, "%s, colour index ? ", prom);
  6491.       colour->val.ind = readintvalue(prompt, PTKECOLOURIND);
  6492.       break;
  6493.  
  6494.     case PMODEL_RGB: 
  6495.       sprintf(prompt, "%s, red ? ", prom);
  6496.       colour->val.general.x = readreal(prompt);
  6497.       sprintf(prompt, "%s, green ? ", prom);
  6498.       colour->val.general.y = readreal(prompt);
  6499.       sprintf(prompt, "%s, blue ? ", prom);
  6500.       colour->val.general.z = readreal(prompt);
  6501.       break;
  6502.  
  6503.     case PMODEL_CIELUV: 
  6504.       sprintf(prompt, "%s, x coefficient ? ", prom);
  6505.       colour->val.general.x = readreal(prompt);
  6506.       sprintf(prompt, "%s, y coefficient ? ", prom);
  6507.       colour->val.general.y = readreal(prompt);
  6508.       sprintf(prompt, "%s, y luminance ? ", prom);
  6509.       colour->val.general.z = readreal(prompt);
  6510.       break;
  6511.  
  6512.     case PMODEL_HSV: 
  6513.       sprintf(prompt, "%s, hue ? ", prom);
  6514.       colour->val.general.x = readreal(prompt);
  6515.       sprintf(prompt, "%s, saturation ? ", prom);
  6516.       colour->val.general.y = readreal(prompt);
  6517.       sprintf(prompt, "%s, value ? ", prom);
  6518.       colour->val.general.z = readreal(prompt);
  6519.       break;
  6520.  
  6521.     case PMODEL_HLS: 
  6522.       sprintf(prompt, "%s, hue ? ", prom);
  6523.       colour->val.general.x = readreal(prompt);
  6524.       sprintf(prompt, "%s, lightness ? ", prom);
  6525.       colour->val.general.y = readreal(prompt);
  6526.       sprintf(prompt, "%s, saturation ? ", prom);
  6527.       colour->val.general.z = readreal(prompt);
  6528.       break;
  6529.   }
  6530.   if (writingscript)
  6531.     phinprintf(PTKEOUTPUT, "\n");
  6532. }  /* readgcolr */
  6533.  
  6534. /*--------------------------------------------------------------------------*/
  6535.  
  6536. static void readcolrep(C(Pint) colmodel, C(Pcolr_rep *) colour, 
  6537.                         C(char *) prompt)
  6538. PreANSI(Pint colmodel)
  6539. PreANSI(Pcolr_rep *colour)
  6540. PreANSI(char *prompt)
  6541. /*
  6542. ** read a colour representation depending on the current
  6543. ** colour model.
  6544. */
  6545. {
  6546.   char prom[80];
  6547.  
  6548.   switch (colmodel)
  6549.   {
  6550.     case PMODEL_RGB: 
  6551.       sprintf(prom, "%s, red ? ", prompt);
  6552.       colour->rgb.red = readreal(prom);
  6553.       sprintf(prom, "%s, green ? ", prompt);
  6554.       colour->rgb.green = readreal(prom);
  6555.       sprintf(prom, "%s, blue ? ", prompt);
  6556.       colour->rgb.blue = readreal(prom);
  6557.       break;
  6558.  
  6559.     case PMODEL_CIELUV: 
  6560.       sprintf(prom, "%s, x coefficient ? ", prompt);
  6561.       colour->cieluv.cieluv_x = readreal(prom);
  6562.       sprintf(prom, "%s, y coefficient ? ", prompt);
  6563.       colour->cieluv.cieluv_y = readreal(prom);
  6564.       sprintf(prom, "%s, y luminance ? ", prompt);
  6565.       colour->cieluv.cieluv_y_lum = readreal(prom);
  6566.       break;
  6567.  
  6568.     case PMODEL_HSV: 
  6569.       sprintf(prom, "%s, hue ? ", prompt);
  6570.       colour->hsv.hue = readreal(prom);
  6571.       sprintf(prom, "%s, saturation ? ", prompt);
  6572.       colour->hsv.satur = readreal(prom);
  6573.       sprintf(prom, "%s, value ? ", prompt);
  6574.       colour->hsv.value = readreal(prom);
  6575.       break;
  6576.  
  6577.     case PMODEL_HLS: 
  6578.       sprintf(prom, "%s, hue ? ", prompt);
  6579.       colour->hls.hue = readreal(prom);
  6580.       sprintf(prom, "%s, lightness ? ", prompt);
  6581.       colour->hls.lightness = readreal(prom);
  6582.       sprintf(prom, "%s, saturation ? ", prompt);
  6583.       colour->hls.satur = readreal(prom);
  6584.       break;
  6585.   }
  6586.   if (writingscript)
  6587.     phinprintf(PTKEOUTPUT, "\n");
  6588. }  /* readcolrep */
  6589.  
  6590. /*--------------------------------------------------------------------------*/
  6591.  
  6592. static void readcolreplist(C(Pint) colmodel, C(Pcolr_rep_list *) colours, 
  6593.                         C(char *) prompt)
  6594. PreANSI(Pint colmodel)
  6595. PreANSI(Pcolr_rep_list *colours)
  6596. PreANSI(char *prompt)
  6597. /*
  6598. ** read a colour representation depending on the current
  6599. ** colour model.
  6600. */
  6601. {
  6602.   Pint i;
  6603.   char prom[80];
  6604.  
  6605.   sprintf(prom, "%s, number of colours ? ", prompt);
  6606.   colours->num_colr_reps = readposinteger(prom);
  6607.   colours->colr_reps = (Pcolr_rep *)calloc(colours->num_colr_reps,
  6608.                                 sizeof(Pcolr_rep));
  6609.   for (i = 0; i < colours->num_colr_reps; i++)
  6610.   {
  6611.     sprintf(prom, "%s, colour [%d]", prompt, i);
  6612.     readcolrep(colmodel, &colours->colr_reps[i], prom); 
  6613.   }
  6614. }  /* readcolreplist */
  6615.  
  6616. /*--------------------------------------------------------------------------*/
  6617.  
  6618. static void readcovalarray(C(Pint) colmodel, C(Pint) num,
  6619.                            C(Pcoval *) colours)
  6620. PreANSI(Pint colmodel)
  6621. PreANSI(Pint num)
  6622. PreANSI(Pcoval *colours)
  6623. /*
  6624. ** read a colour representation depending on the current
  6625. ** colour model.
  6626. */
  6627. {
  6628.   Pint i;
  6629.  
  6630.   if (colmodel == PINDIRECT)
  6631.    for (i = 0; i < num; i++)
  6632.     colours[i].ind = readintvalue("colour index ? ", PTKECOLOURIND);
  6633.   else
  6634.    for (i = 0; i < num; i++)
  6635.     readdirectcolour(colmodel, &colours[i], "direct colour");
  6636. }  /* reacovalarray */
  6637.  
  6638. /*--------------------------------------------------------------------------*/
  6639.  
  6640. static void readreflprops(C(Prefl_props *) props, C(char *) prompt)
  6641. PreANSI(Prefl_props *props)
  6642. PreANSI(char *prompt)
  6643. {
  6644.   char prom[80];
  6645.  
  6646.   sprintf(prom, "%s, ambient coefficient ? ", prompt);
  6647.   props->ambient_coef = readreal(prom);
  6648.   sprintf(prom, "%s, diffuse coefficient ? ", prompt);
  6649.   props->diffuse_coef = readreal(prom);
  6650.   sprintf(prom, "%s, specular coefficient ? ", prompt);
  6651.   props->specular_coef = readreal(prom);
  6652.   sprintf(prom, "%s, specular colour ? ", prompt);
  6653.   readgcolr(&props->specular_colr, prompt);
  6654.   sprintf(prom, "%s, specular exponent ? ", prompt);
  6655.   props->specular_exp = readreal(prom);
  6656.   sprintf(prom, "%s, transparency coefficient ? ", prompt);
  6657.   props->transpar_coef = readreal(prom);
  6658. }  /* readreflprops */
  6659.  
  6660. /*--------------------------------------------------------------------------*/
  6661.  
  6662. static void readlinebundleplus(C(Pline_bundle_plus *) bundl)
  6663. PreANSI(Pline_bundle_plus *bundl)
  6664. {
  6665.   bundl->type = readinteger("linetype ? ");
  6666.   bundl->width = readreal("linewidth scale factor ? ");
  6667.   readgcolr(&bundl->colr, "line colour");
  6668.   bundl->shad_meth = readinteger("line shading method ? ");
  6669.   bundl->approx_type = readinteger("curve approx type ? ");
  6670.   bundl->approx_val = readreal("curve approx value ? ");
  6671. }  /* readlinebundleplus */
  6672.  
  6673. /*--------------------------------------------------------------------------*/
  6674.  
  6675. static void readmarkerbundleplus(C(Pmarker_bundle_plus *) bundl)
  6676. PreANSI(Pmarker_bundle_plus *bundl)
  6677. {
  6678.   bundl->type = readinteger("marker type ? ");
  6679.   bundl->size = readreal("marker size scale factor ? ");
  6680.   readgcolr(&bundl->colr, "marker colour");
  6681. }  /* readmarkerbundleplus */
  6682.  
  6683. /*--------------------------------------------------------------------------*/
  6684.  
  6685. static void readedgebundleplus(C(Pedge_bundle_plus *) bundl)
  6686. PreANSI(Pedge_bundle_plus *bundl)
  6687. {
  6688.   bundl->flag = readphigsenum(PTKEEDGEF, "edge flag ? ");
  6689.   bundl->type = readinteger("edgetype ? ");
  6690.   bundl->width = readreal("edgewidth scale factor ? ");
  6691.   readgcolr(&bundl->colr, "edge colour");
  6692. }  /* readedgebundleplus */
  6693.  
  6694. /*--------------------------------------------------------------------------*/
  6695.  
  6696. static void readinterbundleplus(C(Pint_bundle_plus *) bundl)
  6697. PreANSI(Pint_bundle_plus *bundl)
  6698. {
  6699.   bundl->style = readphigsenum(PTKEINTERSTYLE, "interior style ? ");
  6700.   bundl->style_ind = readinteger("interior style index ? ");
  6701.   readgcolr(&bundl->colr, "interior colour");
  6702.   bundl->refl_eqn = readinteger("reflectance model ? ");
  6703.   bundl->shad_meth = readinteger("shading method ? ");
  6704.   readreflprops(&bundl->refl_props, "reflectance properties");
  6705.   bundl->back_style = readphigsenum(PTKEINTERSTYLE, "back interior style ? ");
  6706.   bundl->back_style_ind = readinteger("back interior style index ? ");
  6707.   readgcolr(&bundl->back_colr, "back interior colour");
  6708.   bundl->back_refl_eqn = readinteger("back reflectance model ? ");
  6709.   bundl->back_shad_meth = readinteger("back shading method ? ");
  6710.   readreflprops(&bundl->back_refl_props, "back reflectance properties");
  6711.   bundl->approx_type = readinteger("approximation type ? ");
  6712.   bundl->approx_val[0] = readreal("approximation value, u ? ");
  6713.   bundl->approx_val[1] = readreal("approximation value, v ? ");
  6714. }  /* readinterbundleplus */
  6715.  
  6716. /*--------------------------------------------------------------------------*/
  6717.  
  6718. static void readtextbundleplus(C(Ptext_bundle_plus *) bundl)
  6719. PreANSI(Ptext_bundle_plus *bundl)
  6720. {
  6721.   bundl->font = readinteger("text font ? ");
  6722.   bundl->prec = readphigsenum(PTKETXPREC, "text precision ? ");
  6723.   bundl->char_expan = readreal("character expansion factor ? ");
  6724.   bundl->char_space = readreal("character spacing ? ");
  6725.   readgcolr(&bundl->colr, "text colour");
  6726. }  /* readtextbundleplus */
  6727.  
  6728. /*--------------------------------------------------------------------------*/
  6729.  
  6730. static void readpatrepplus(C(Ppat_rep_plus *) rep)
  6731. PreANSI(Ppat_rep_plus *rep)
  6732. {
  6733.   Pint i, numcols;
  6734.  
  6735.   rep->dims.size_x = readinteger("number of divisions along X ? ");
  6736.   rep->dims.size_y = readinteger("number of divisions along Y ? ");
  6737.   numcols = rep->dims.size_x * rep->dims.size_y;
  6738.   rep->type = readinteger("colour type ? ");
  6739.   rep->colr_array = (Pcoval *)calloc(numcols, sizeof(Pcoval));
  6740.   readcovalarray(rep->type, numcols, rep->colr_array);
  6741. }  /* readpatrepplus */
  6742.  
  6743. /*--------------------------------------------------------------------------*/
  6744.  
  6745. static void readdcuebundle(C(Pdcue_bundle *) bundl)
  6746. PreANSI(Pdcue_bundle *bundl)
  6747. {
  6748.   bundl->mode = readphigsenum(PTKEDCUEMODE, "depth cue mode ? ");
  6749.   bundl->ref_planes[0] = readreal("back reference plane ? ");
  6750.   bundl->ref_planes[1] = readreal("front reference plane ? ");
  6751.   bundl->scaling[0] = readreal("back scaling ? ");
  6752.   bundl->scaling[1] = readreal("front scaling ? ");
  6753.   readgcolr(&bundl->colr, "depth cue colour");
  6754. }  /* readdcuebundle */
  6755.  
  6756. /*--------------------------------------------------------------------------*/
  6757.  
  6758. static void readlightsrcbundle(C(Plight_src_bundle *) light)
  6759. PreANSI(Plight_src_bundle *light)
  6760. {
  6761.   light->type = readinteger("light source type ? ");
  6762.   switch (light->type)
  6763.   {
  6764.     case PLIGHT_AMBIENT:
  6765.       readgcolr(&light->rec.ambient.colr, "light source colour");
  6766.       break;
  6767.  
  6768.     case PLIGHT_DIRECTIONAL:
  6769.       readgcolr(&light->rec.directional.colr, "light source colour");
  6770.       light->rec.directional.dir = readvector3("light source direction");
  6771.       break;
  6772.  
  6773.     case PLIGHT_POSITIONAL:
  6774.       readgcolr(&light->rec.positional.colr, "light source colour");
  6775.       light->rec.positional.pos = readpoint3("light source position");
  6776.       light->rec.positional.coef[0] = 
  6777.         readreal("attenuation coefficients [0] ? ");
  6778.       light->rec.positional.coef[1] = 
  6779.         readreal("attenuation coefficients [1] ? ");
  6780.       break;
  6781.  
  6782.     case PLIGHT_SPOT:
  6783.       readgcolr(&light->rec.spot.colr, "light source colour");
  6784.       light->rec.spot.pos = readpoint3("light source position");
  6785.       light->rec.spot.dir = readvector3("light source direction");
  6786.       light->rec.spot.exp = readreal("concentration exponent ? ");
  6787.       light->rec.spot.coef[0] = 
  6788.         readreal("attenuation coefficients [0] ? ");
  6789.       light->rec.spot.coef[1] = 
  6790.         readreal("attenuation coefficients [1] ? ");
  6791.       light->rec.spot.angle = readreal("spread angle ? ");
  6792.       break;
  6793.   }
  6794. }  /* readlightsrcbundle */
  6795.  
  6796. /*--------------------------------------------------------------------------*/
  6797.  
  6798. static void readparasurfcharacs(C(Pint) psctype, 
  6799.                                 C(Ppara_surf_characs *) psurf)
  6800. PreANSI(Pint psctype)
  6801. PreANSI(Ppara_surf_characs *psurf)
  6802. {
  6803.   switch (psctype)
  6804.   {
  6805.     case PSC_NONE:
  6806.       break;
  6807.  
  6808.     case PSC_WS_DEP:
  6809.       break;
  6810.  
  6811.     case PSC_ISOPARAMETRIC_CURVES:
  6812.       psurf->psc_3.placement = readphigsenum(PTKECURVEPLACE, 
  6813.                                 "curve placement ? ");
  6814.       psurf->psc_3.u_count = readinteger("u count ? ");
  6815.       psurf->psc_3.v_count = readinteger("v count ? ");
  6816.       break;
  6817.  
  6818.     case PSC_LEVEL_CURVES_MC:
  6819.       psurf->psc_4.origin = readpoint3("origin");
  6820.       psurf->psc_4.direction = readvector3("direction");
  6821.       readfloatlist(&psurf->psc_4.params, "params");
  6822.       break;
  6823.  
  6824.     case PSC_LEVEL_CURVES_WC:
  6825.       psurf->psc_5.origin = readpoint3("origin");
  6826.       psurf->psc_5.direction = readvector3("direction");
  6827.       readfloatlist(&psurf->psc_5.params, "params");
  6828.       break;
  6829.   }
  6830. }  /* readparasurfcharacs */
  6831.  
  6832. /*--------------------------------------------------------------------------*/
  6833.  
  6834. static void readfacetvdatalist3(C(Pint) vflag, C(Pint) colour_model,
  6835.                                 C(Pint) num, C(Pfacet_vdata_list3 *) vdata)
  6836. PreANSI(Pint vflag)
  6837. PreANSI(Pint colour_model)
  6838. PreANSI(Pint num)
  6839. PreANSI(Pfacet_vdata_list3 *vdata)
  6840. /*
  6841. ** read list of nfa fill area set and optionally associated colour
  6842. ** information.
  6843. */
  6844. {
  6845.   Pint j;
  6846.   char prom[80];
  6847.  
  6848.   sprintf(prom, "facet [%d], number of vertices ? ", num);
  6849.   vdata->num_vertices = readinteger(prom);
  6850.   switch (vflag)
  6851.   {
  6852.     case PVERT_COORD:
  6853.       vdata->vertex_data.points = (Ppoint3 *)calloc(vdata->num_vertices,
  6854.                               sizeof(Ppoint3));
  6855.       for (j = 0; j < vdata->num_vertices; j++)
  6856.       {
  6857.         sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
  6858.         vdata->vertex_data.points[j] = readpoint3(prom);
  6859.       }
  6860.       break;
  6861.  
  6862.     case PVERT_COORD_COLOUR:
  6863.       vdata->vertex_data.ptcolrs = (Pptco3 *)calloc(vdata->num_vertices,
  6864.                               sizeof(Pptco3));
  6865.       for (j = 0; j < vdata->num_vertices; j++)
  6866.       {
  6867.         sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
  6868.         vdata->vertex_data.ptcolrs[j].point = readpoint3(prom);
  6869.         if (colour_model == PINDIRECT)
  6870.         {
  6871.           sprintf(prom, "facet [%d], colour index [%d] ? ", num, j);
  6872.           vdata->vertex_data.ptcolrs[j].colr.ind = 
  6873.             readintvalue(prom, PTKECOLOURIND);
  6874.         }
  6875.         else
  6876.         {
  6877.           sprintf(prom, "facet [%d], direct colour [%d]", num, j);
  6878.           readdirectcolour(colour_model, 
  6879.             vdata->vertex_data.ptcolrs[j].colr, prom);
  6880.         }      
  6881.       }
  6882.       break;
  6883.  
  6884.     case PVERT_COORD_NORMAL:
  6885.       vdata->vertex_data.ptnorms = 
  6886.         (Pptnorm3 *)calloc(vdata->num_vertices, sizeof(Pptnorm3));
  6887.       for (j = 0; j < vdata->num_vertices; j++)
  6888.       {
  6889.         sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
  6890.         vdata->vertex_data.ptnorms[j].point = readpoint3(prom);
  6891.         sprintf(prom, "facet [%d], normal [%d] ? ", num, j);
  6892.         vdata->vertex_data.ptnorms[j].norm = readvector3(prom);
  6893.       }
  6894.       break;
  6895.  
  6896.     case PVERT_COORD_COLOUR_NORMAL:
  6897.       vdata->vertex_data.ptconorms = 
  6898.         (Pptconorm3 *)calloc(vdata->num_vertices, sizeof(Pptconorm3));
  6899.       for (j = 0; j < vdata->num_vertices; j++)
  6900.       {
  6901.         sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
  6902.         vdata->vertex_data.ptconorms[j].point = readpoint3(prom);
  6903.         if (colour_model == PINDIRECT)
  6904.         {
  6905.           sprintf(prom, "facet [%d], colour index [%d] ? ", num, j);
  6906.           vdata->vertex_data.ptconorms[j].colr.ind = 
  6907.             readintvalue(prom, PTKECOLOURIND);
  6908.         }
  6909.         else
  6910.         {
  6911.           sprintf(prom, "facet [%d], direct colour [%d]", num, j);
  6912.           readdirectcolour(colour_model, 
  6913.             vdata->vertex_data.ptconorms[j].colr, prom);
  6914.         }      
  6915.         sprintf(prom, "facet [%d], normal [%d] ? ", num, j);
  6916.         vdata->vertex_data.ptconorms[j].norm = readvector3(prom);
  6917.       }
  6918.       break;
  6919.   }
  6920. }  /* readfacetvdatalist3 */
  6921.  
  6922. /*--------------------------------------------------------------------------*/
  6923.  
  6924. static void readfacetvdataarr3(C(Pint) vflag, C(Pint) colour_model,
  6925.                        C(Pint) nv, C(Pfacet_vdata_arr3 *) vdata)
  6926. PreANSI(Pint vflag)
  6927. PreANSI(Pint colour_model)
  6928. PreANSI(Pint nv)
  6929. PreANSI(Pfacet_vdata_arr3 *vdata)
  6930. /*
  6931. ** read list of nfa fill area set and optionally associated colour
  6932. ** information.
  6933. */
  6934. {
  6935.   Pint i, j;
  6936.   char prom[80];
  6937.  
  6938.   sprintf(prom, "facet [%d], number of vertices ? ", i);
  6939.   switch (vflag)
  6940.   {
  6941.     case PVERT_COORD:
  6942.       vdata->points = (Ppoint3 *)calloc(nv, sizeof(Ppoint3));
  6943.       for (i = 0; i < nv; i++)
  6944.       {
  6945.         sprintf(prom, "vertex [%d] ? ", i);
  6946.         vdata->points[i] = readpoint3(prom);
  6947.       }
  6948.       break;
  6949.  
  6950.     case PVERT_COORD_COLOUR:
  6951.       vdata->ptcolrs = (Pptco3 *)calloc(nv, sizeof(Pptco3));
  6952.       for (i = 0; i < nv; i++)
  6953.       {
  6954.         sprintf(prom, "vertex [%d] ? ", i);
  6955.         vdata->ptcolrs[i].point = readpoint3(prom);
  6956.         if (colour_model == PINDIRECT)
  6957.         {
  6958.           sprintf(prom, "colour index [%d] ? ", i);
  6959.           vdata->ptcolrs[i].colr.ind = 
  6960.             readintvalue(prom, PTKECOLOURIND);
  6961.         }
  6962.         else
  6963.         {
  6964.           sprintf(prom, "direct colour [%d]", i);
  6965.           readdirectcolour(colour_model, 
  6966.             vdata->ptcolrs[i].colr, prom);
  6967.         }      
  6968.       }
  6969.       break;
  6970.  
  6971.     case PVERT_COORD_NORMAL:
  6972.       vdata->ptnorms = (Pptnorm3 *)calloc(nv, sizeof(Pptnorm3));
  6973.       for (i = 0; i < nv; i++)
  6974.       {
  6975.         sprintf(prom, "vertex [%d] ? ", i);
  6976.         vdata->ptnorms[i].point = readpoint3(prom);
  6977.         sprintf(prom, "normal [%d] ? ", i);
  6978.         vdata->ptnorms[i].norm = readvector3(prom);
  6979.       }
  6980.       break;
  6981.  
  6982.     case PVERT_COORD_COLOUR_NORMAL:
  6983.       vdata->ptconorms = (Pptconorm3 *)calloc(nv, sizeof(Pptconorm3));
  6984.       for (i = 0; i < nv; i++)
  6985.       {
  6986.         sprintf(prom, "vertex [%d] ? ", i);
  6987.         vdata->ptconorms[i].point = readpoint3(prom);
  6988.         if (colour_model == PINDIRECT)
  6989.         {
  6990.           sprintf(prom, "colour index [%d] ? ", i);
  6991.           vdata->ptconorms[i].colr.ind = readintvalue(prom, PTKECOLOURIND);
  6992.         }
  6993.         else
  6994.         {
  6995.           sprintf(prom, "direct colour [%d]", i);
  6996.           readdirectcolour(colour_model, 
  6997.             vdata->ptconorms[i].colr, prom);
  6998.         }      
  6999.         sprintf(prom, "normal [%d] ? ", i);
  7000.         vdata->ptconorms[i].norm = readvector3(prom);
  7001.       }
  7002.       break;
  7003.   }
  7004. }  /* readfacetvdataarr3 */
  7005.  
  7006. /*--------------------------------------------------------------------------*/
  7007.  
  7008. static void readlinevdatalist3(C(Pint) vflag, C(Pint) colour_model,
  7009.                                 C(Pint) num, C(Pline_vdata_list3 *) vdata)
  7010. PreANSI(Pint vflag)
  7011. PreANSI(Pint colour_model)
  7012. PreANSI(Pint num)
  7013. PreANSI(Pline_vdata_list3 *vdata)
  7014. /*
  7015. ** read list of nfa fill area set and optionally associated colour
  7016. ** information.
  7017. */
  7018. {
  7019.   Pint j;
  7020.   char prom[80];
  7021.  
  7022.   sprintf(prom, "line [%d], number of vertices ? ", num);
  7023.   vdata->num_vertices = readinteger(prom);
  7024.   switch (vflag)
  7025.   {
  7026.     case PVERT_COORD:
  7027.      vdata->vertex_data.points = (Ppoint3 *)calloc(vdata->num_vertices,
  7028.                              sizeof(Ppoint3));
  7029.      for (j = 0; j < vdata->num_vertices; j++)
  7030.      {
  7031.        sprintf(prom, "line [%d], vertex [%d] ? ", num, j);
  7032.        vdata->vertex_data.points[j] = readpoint3(prom);
  7033.      }
  7034.      break;
  7035.  
  7036.     case PVERT_COORD_COLOUR:
  7037.      vdata->vertex_data.ptcolrs = (Pptco3 *)calloc(vdata->num_vertices,
  7038.                              sizeof(Pptco3));
  7039.      for (j = 0; j < vdata->num_vertices; j++)
  7040.      {
  7041.        sprintf(prom, "line [%d], vertex [%d] ? ", num, j);
  7042.        vdata->vertex_data.ptcolrs[j].point = readpoint3(prom);
  7043.        if (colour_model == PINDIRECT)
  7044.        {
  7045.          sprintf(prom, "line [%d], colour index [%d] ? ", num, j);
  7046.          vdata->vertex_data.ptcolrs[j].colr.ind = 
  7047.            readintvalue(prom, PTKECOLOURIND);
  7048.        }
  7049.        else
  7050.        {
  7051.          sprintf(prom, "line [%d], direct colour [%d]", num, j);
  7052.          readdirectcolour(colour_model, 
  7053.            vdata->vertex_data.ptcolrs[j].colr, prom);
  7054.        }      
  7055.      }
  7056.      break;
  7057.   }
  7058. }  /* readlinevdatalist3 */
  7059.  
  7060. /*--------------------------------------------------------------------------*/
  7061.  
  7062. static void readfacetdata3(C(Pint) fflag, C(Pint) colour_model, 
  7063.                                 C(Pfacet_data3 *) fdata)
  7064. PreANSI(Pint fflag)
  7065. PreANSI(Pint colour_model)
  7066. PreANSI(Pfacet_data3 *fdata)
  7067. /*
  7068. ** read facet data record.
  7069. */
  7070. {
  7071.   char prom[80];
  7072.  
  7073.   switch (fflag)
  7074.   {
  7075.     case PFACET_NONE:
  7076.       break;
  7077.  
  7078.     case PFACET_COLOUR:
  7079.       if (colour_model == PINDIRECT)
  7080.         fdata->colr.ind = readintvalue("facet colour index ? ", 
  7081.                                       PTKECOLOURIND);
  7082.       else
  7083.         readdirectcolour(colour_model, &fdata->colr, "facet direct colour");
  7084.       break;
  7085.  
  7086.     case PFACET_NORMAL:
  7087.       fdata->norm = readvector3("facet normal");
  7088.       break;
  7089.  
  7090.     case PFACET_COLOUR_NORMAL:
  7091.       if (colour_model == PINDIRECT)
  7092.         fdata->conorm.colr.ind = readintvalue("facet colour index ? ", 
  7093.                                       PTKECOLOURIND);
  7094.       else
  7095.         readdirectcolour(colour_model, &fdata->conorm.colr, 
  7096.                          "facet direct colour");
  7097.       fdata->conorm.norm = readvector3("facet normal");
  7098.       break;
  7099.   }
  7100. }  /* readfacetdata3 */
  7101.  
  7102. /*--------------------------------------------------------------------------*/
  7103.  
  7104. static void readfacetdataarr3(C(Pint) fflag, C(Pint) colour_model, 
  7105.                    C(Pint) num, C(Pfacet_data_arr3 *) fdata)
  7106. PreANSI(Pint fflag)
  7107. PreANSI(Pint colour_model)
  7108. PreANSI(Pint num)
  7109. PreANSI(Pfacet_data_arr3 *fdata)
  7110. /*
  7111. ** read facet data record.
  7112. */
  7113. {
  7114.   char prom[80];
  7115.   Pint i;
  7116.  
  7117.   switch (fflag)
  7118.   {
  7119.     case PFACET_NONE:
  7120.       break;
  7121.  
  7122.     case PFACET_COLOUR:
  7123.       fdata->colrs = (Pcoval *)calloc(num, sizeof(Pcoval));
  7124.       if (colour_model == PINDIRECT)
  7125.       {
  7126.         for (i = 0; i < num; i++)
  7127.     {
  7128.           sprintf(prom, "facet colour [%d] ? ", i);
  7129.           fdata->colrs[i].ind = readintvalue(prom, PTKECOLOURIND);
  7130.         }
  7131.       }
  7132.       else
  7133.       {
  7134.         for (i = 0; i < num; i++)   
  7135.     {
  7136.           sprintf(prom, "facet direct colour [%d]", i);
  7137.           readdirectcolour(colour_model, &fdata->colrs[i], prom);
  7138.         }
  7139.       }
  7140.       break;
  7141.  
  7142.     case PFACET_NORMAL:
  7143.       fdata->norms = (Pvec3 *)calloc(num, sizeof(Pvec3));
  7144.       for (i = 0; i < num; i++)   
  7145.       {
  7146.         sprintf(prom, "facet normal [%d]", i);
  7147.         fdata->norms[i] = readvector3(prom);
  7148.       }
  7149.       break;
  7150.  
  7151.     case PFACET_COLOUR_NORMAL:
  7152.       fdata->conorms = (Pconorm3 *)calloc(num, sizeof(Pconorm3));
  7153.       for (i = 0; i < num; i++)   
  7154.       {
  7155.         if (colour_model == PINDIRECT)
  7156.     {
  7157.           sprintf(prom, "facet colour [%d] ? ", i);
  7158.           fdata->conorms[i].colr.ind = readintvalue(prom, PTKECOLOURIND);
  7159.         }
  7160.         else
  7161.         {
  7162.           sprintf(prom, "facet direct colour [%d]", i);
  7163.           readdirectcolour(colour_model, &fdata->conorms[i].colr, prom);
  7164.         }
  7165.         sprintf(prom, "facet normal [%d]", i);
  7166.         fdata->conorms[i].norm = readvector3(prom);
  7167.       }
  7168.       break;
  7169.   }
  7170. }  /* readfacetdataarr3 */
  7171.  
  7172. /*--------------------------------------------------------------------------*/
  7173.  
  7174. static void readedgedatalist(C(Pint) num, C(Pedge_data_list *) edata)
  7175. PreANSI(Pint num)
  7176. PreANSI(Pedge_data_list *edata)
  7177. /*
  7178. ** read list of nfa edge information.
  7179. */
  7180. {
  7181.   Pint j;
  7182.   char prom[80];
  7183.  
  7184.   sprintf(prom, "facet [%d], number of edges ? ", num);
  7185.   edata->num_edges = readinteger(prom);
  7186.   edata->edgedata.edges = (Pedge_flag *)calloc(edata->num_edges,
  7187.                               sizeof(Pedge_flag));
  7188.   for (j = 0; j < edata->num_edges; j++)
  7189.   {
  7190.     sprintf(prom, "facet [%d], edge flag [%d] ? ", num, j);
  7191.     edata->edgedata.edges[j] = readphigsenum(PTKEEDGEF, prom);
  7192.   }
  7193. }  /* readedgedatalist */
  7194.  
  7195. /*--------------------------------------------------------------------------*/
  7196.  
  7197. static void readedgedatalistlist(C(char *) prompt,
  7198.                                  C(Pedge_data_list_list *) edata)
  7199. PreANSI(char *prompt)
  7200. PreANSI(Pedge_data_list_list *edata)
  7201. /*
  7202. ** read list of edge lists information.
  7203. */
  7204. {
  7205.   Pint i, j;
  7206.   char prom[80];
  7207.  
  7208.   edata->num_lists = readinteger("number of bounds in facet ? ");
  7209.   edata->edgelist = (Pedge_data_list *)calloc(edata->num_lists, 
  7210.                        sizeof(Pedge_data_list));
  7211.   for (i = 0; i < edata->num_lists; i++)
  7212.     readedgedatalist(i, &edata->edgelist[i]);
  7213. }  /* readedgedatalist */
  7214.  
  7215. /*--------------------------------------------------------------------------*/
  7216.  
  7217. static Ppoint4 readpoint4(C(char *) prom)
  7218. PreANSI(char *prom)
  7219. {
  7220.   Ppoint4 t;
  7221.   char pointprom[255];
  7222.  
  7223.   sprintf(pointprom, "%s, x ? ", prom);
  7224.   t.x = readreal(pointprom);
  7225.   sprintf(pointprom, "%s, y ? ", prom);
  7226.   t.y = readreal(pointprom);
  7227.   sprintf(pointprom, "%s, z ? ", prom);
  7228.   t.z = readreal(pointprom);
  7229.   sprintf(pointprom, "%s, w ? ", prom);
  7230.   t.w = readreal(pointprom);
  7231.   if (writingscript)
  7232.     phinprintf(PTKEOUTPUT, "\n");
  7233.   return t;
  7234. }  /* readpoint4 */
  7235.  
  7236. /*--------------------------------------------------------------------------*/
  7237.  
  7238. static void readpointlist23(C(Prational) rationality, 
  7239.                             C(Ppoint_list23 *) plist, C(char *) prompt)
  7240. PreANSI(Prational rationality)
  7241. PreANSI(Ppoint_list23 *plist)
  7242. PreANSI(char *prompt)
  7243. {
  7244.   Pint i, n;
  7245.   char prom[30];
  7246.  
  7247.   sprintf(prom, "%s, number of points ? ", prompt);
  7248.   plist->num_points = readinteger(prom);
  7249.   if (rationality == PRATIONAL)
  7250.   {
  7251.     plist->points.point3d = (Ppoint3 *)calloc(plist->num_points, 
  7252.                               sizeof(Ppoint3));
  7253.     for (i = 0; i < plist->num_points; i++) 
  7254.     {
  7255.       sprintf(prom, "%s, point [%d]", prompt, i);
  7256.       plist->points.point3d[i] = readpoint3(prom);
  7257.       if (writingscript)
  7258.         phinprintf(PTKEOUTPUT, "\n");
  7259.     }
  7260.   }
  7261.   else
  7262.   {
  7263.     plist->points.point2d = (Ppoint *)calloc(plist->num_points, 
  7264.                               sizeof(Ppoint));
  7265.     for (i = 0; i < plist->num_points; i++) 
  7266.     {
  7267.       sprintf(prom, "%s, point [%d]", prompt, i);
  7268.       plist->points.point2d[i] = readpoint(prom);
  7269.       if (writingscript)
  7270.         phinprintf(PTKEOUTPUT, "\n");
  7271.     }
  7272.   }
  7273. }  /* readpointlist23 */
  7274.  
  7275. /*--------------------------------------------------------------------------*/
  7276.  
  7277. static void readpointlist34(C(Prational) rationality, 
  7278.                             C(Ppoint_list34 *) plist, C(char *) prompt)
  7279. PreANSI(Prational rationality)
  7280. PreANSI(Ppoint_list34 *plist)
  7281. PreANSI(char *prompt)
  7282. {
  7283.   Pint i, n;
  7284.   char prom[30];
  7285.  
  7286.   sprintf(prom, "%s, number of points ? ", prompt);
  7287.   plist->num_points = readinteger(prom);
  7288.   if (rationality == PRATIONAL)
  7289.   {
  7290.     plist->points.point4d = (Ppoint4 *)calloc(plist->num_points, 
  7291.                               sizeof(Ppoint4));
  7292.     for (i = 0; i < plist->num_points; i++) 
  7293.     {
  7294.       sprintf(prom, "%s, point [%d]", prompt, i);
  7295.       plist->points.point4d[i] = readpoint4(prom);
  7296.       if (writingscript)
  7297.         phinprintf(PTKEOUTPUT, "\n");
  7298.     }
  7299.   }
  7300.   else
  7301.   {
  7302.     plist->points.point3d = (Ppoint3 *)calloc(plist->num_points, 
  7303.                               sizeof(Ppoint3));
  7304.     for (i = 0; i < plist->num_points; i++) 
  7305.     {
  7306.       sprintf(prom, "%s, point [%d]", prompt, i);
  7307.       plist->points.point3d[i] = readpoint3(prom);
  7308.       if (writingscript)
  7309.         phinprintf(PTKEOUTPUT, "\n");
  7310.     }
  7311.   }
  7312. }  /* readpointlist34 */
  7313.  
  7314. /*--------------------------------------------------------------------------*/
  7315.  
  7316. static void readpointgrid34(C(Prational) rationality, 
  7317.                             C(Ppoint_grid34 *) plist, C(char *) prompt)
  7318. PreANSI(Prational rationality)
  7319. PreANSI(Ppoint_grid34 *plist)
  7320. PreANSI(char *prompt)
  7321. {
  7322.   Pint i, numpts;
  7323.   char prom[30];
  7324.  
  7325.   sprintf(prom, "%s, number of points along U ? ", prompt);
  7326.   plist->num_points.u_dim = readinteger(prom);
  7327.   sprintf(prom, "%s, number of points along V ? ", prompt);
  7328.   plist->num_points.v_dim = readinteger(prom);
  7329.   numpts = plist->num_points.u_dim * plist->num_points.v_dim;
  7330.   if (rationality == PRATIONAL)
  7331.   {
  7332.     plist->points.point4d = (Ppoint4 *)calloc(numpts, sizeof(Ppoint4));
  7333.     for (i = 0; i < numpts; i++) 
  7334.     {
  7335.       sprintf(prom, "%s, point [%d]", prompt, i);
  7336.       plist->points.point4d[i] = readpoint4(prom);
  7337.       if (writingscript)
  7338.         phinprintf(PTKEOUTPUT, "\n");
  7339.     }
  7340.   }
  7341.   else
  7342.   {
  7343.     plist->points.point3d = (Ppoint3 *)calloc(numpts, sizeof(Ppoint3));
  7344.     for (i = 0; i < numpts; i++) 
  7345.     {
  7346.       sprintf(prom, "%s, point [%d]", prompt, i);
  7347.       plist->points.point3d[i] = readpoint3(prom);
  7348.       if (writingscript)
  7349.         phinprintf(PTKEOUTPUT, "\n");
  7350.     }
  7351.   }
  7352. }  /* readpointgrid34 */
  7353.  
  7354. /*--------------------------------------------------------------------------*/
  7355.  
  7356. static void readtrimcurvelist(C(Ptrimcurve_list *) tlist, C(char *) prompt)
  7357. PreANSI(Ptrimcurve_list *tlist)
  7358. PreANSI(char *prompt)
  7359. {
  7360.   Pint i, numpts;
  7361.   char prom[30];
  7362.  
  7363.   sprintf(prom, "%s, number of curves ? ", prompt);
  7364.   tlist->num_curves = readinteger(prom);
  7365.   tlist->curves = (Ptrimcurve *)calloc(tlist->num_curves, 
  7366.                                        sizeof(Ptrimcurve));
  7367.   for (i = 0; i < tlist->num_curves; i++)
  7368.   {
  7369.     tlist->curves[i].visible = readphigsenum(PTKEEDGEF, 
  7370.                                  "curve visibility flag ? ");
  7371.     tlist->curves[i].rationality = readphigsenum(PTKERATIONAL,
  7372.                                     "rationality ? ");
  7373.     tlist->curves[i].order = readinteger("order ? ");
  7374.     tlist->curves[i].approx_type = readinteger("approx type ? ");
  7375.     tlist->curves[i].approx_val = readreal("approx value ? ");
  7376.     readfloatlist(&tlist->curves[i].knots, "knots");
  7377.     tlist->curves[i].tmin = readreal("curve range, minimum ? ");    
  7378.     tlist->curves[i].tmax = readreal("curve range, maximum ? ");
  7379.     readpointlist23(tlist->curves[i].rationality, &tlist->curves[i].cpts,
  7380.                     "control points");
  7381.   }
  7382. }  /* readtrimcurvelist */
  7383.  
  7384. /*--------------------------------------------------------------------------*/
  7385.  
  7386. static void readcolrmapdata(C(Pint) method, C(Pcolr_map_data *) mdata, 
  7387.                             C(char *) prompt)
  7388. PreANSI(Pint method)
  7389. PreANSI(Pcolr_map_data *mdata)
  7390. PreANSI(char *prompt)
  7391. {
  7392.   Pint i;
  7393.   char prom[80];
  7394.  
  7395.   switch (method)
  7396.   {
  7397.     case PCOLR_MAP_TRUE:
  7398.       break;
  7399.  
  7400.     case PCOLR_MAP_PSEUDO:
  7401.       sprintf(prom, "%s, colour model ? ", prompt);
  7402.       mdata->meth_r2.colr_model = readinteger(prom);
  7403.       sprintf(prom, "%s, weights", prompt);
  7404.       readfloatlist(&mdata->meth_r2.weights, prom);
  7405.       sprintf(prom, "%s, colours", prompt);
  7406.       readcolreplist(mdata->meth_r2.colr_model, &mdata->meth_r2.colrs, prom);
  7407.       break;
  7408.  
  7409.     case PCOLR_MAP_PSEUDO_N:
  7410.       sprintf(prom, "%s, colour model ? ", prompt);
  7411.       mdata->meth_r3.colr_model = readinteger(prom);
  7412.       sprintf(prom, "%s, number of colours", prompt);
  7413.       mdata->meth_r3.colr_lists.num_lists = readinteger(prom);
  7414.       mdata->meth_r3.colr_lists.lists = 
  7415.         (Pfloat_list *)calloc(mdata->meth_r3.colr_lists.num_lists,
  7416.                               sizeof(Pfloat_list));
  7417.       for (i = 0; i < mdata->meth_r3.colr_lists.num_lists; i++)
  7418.       {
  7419.         sprintf(prom, "%s, colour [%d]", prompt, i);
  7420.         readfloatlist(&mdata->meth_r3.colr_lists.lists[i], prom);
  7421.       }
  7422.       break;
  7423.   }
  7424. }  /* readcolrmapdata */
  7425.  
  7426. /*--------------------------------------------------------------------------*/
  7427.  
  7428. #endif
  7429.  
  7430. /*--------------------------------------------------------------------------*/
  7431. /*---------------------- PHIGS functions -----------------------------------*/
  7432. /*--------------------------------------------------------------------------*/
  7433.  
  7434. static void do_paddnameset()
  7435. {
  7436.   Pint_list addset;
  7437.  
  7438.   readintlst(&addset, "name set", PTKENAME);
  7439.   padd_names_set(&addset);
  7440.   free(addset.ints);
  7441. }  /* do_paddnameset */
  7442.  
  7443. /*--------------------------------------------------------------------------*/
  7444.  
  7445. static void do_pannotationtextrelative()
  7446. {
  7447.   Ppoint refpt, offset;
  7448.   char str[255];
  7449.  
  7450.   refpt = readpoint("reference point");
  7451.   offset = readpoint("annotation offset");
  7452.   readquote(str, "annotation text string ? ");
  7453.   panno_text_rel(&refpt, &offset, str);
  7454. }  /* do_pannotationtextrelative */
  7455.  
  7456. /*--------------------------------------------------------------------------*/
  7457.  
  7458. static void do_pannotationtextrelative3()
  7459. {
  7460.   Ppoint3 refpt, offset;
  7461.   char str[255];
  7462.  
  7463.   refpt = readpoint3("reference point");
  7464.   offset = readpoint3("annotation offset");
  7465.   readquote(str, "annotation text string ? ");
  7466.   panno_text_rel3(&refpt, &offset, str);
  7467. }  /* do_pannotationtextrelative3 */
  7468.  
  7469. /*--------------------------------------------------------------------------*/
  7470.  
  7471. static void do_papplicationdata()
  7472. {
  7473.   Pdata appldata;
  7474.   char applstr[255];
  7475.  
  7476.   appldata.data = applstr;
  7477.   readquote(applstr, "application data ? ");
  7478.   appldata.size = strlen(applstr) + 1;
  7479.   pappl_data(&appldata);
  7480. }  /* do_papplicationdata */
  7481.  
  7482. /*--------------------------------------------------------------------------*/
  7483.  
  7484. static void do_parallstruct()
  7485. {
  7486.   par_all_structs(readinteger("archive identifier ? "));
  7487. }  /* do_parallstruct */
  7488.  
  7489. /*--------------------------------------------------------------------------*/
  7490.  
  7491. static void do_parstruct()
  7492. {
  7493.   Pint i, libid;
  7494.   Pint_list sns;
  7495.   char prom[50];
  7496.  
  7497. #ifdef HP
  7498.   phintererror(1, (char *)NULL, INFORM);
  7499. #else
  7500.   libid = readinteger("archive identifier ? ");
  7501.   sns.num_ints = readposinteger("number of structures to archive ? ");
  7502.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
  7503.   for (i = 0; i < sns.num_ints; i++) 
  7504.   {
  7505.     sprintf(prom, "structure identifier [%d] ? ", i);
  7506.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  7507.   }
  7508.   par_structs(libid, &sns);
  7509.   free(sns.ints);
  7510. #endif
  7511. }  /* do_parstruct */
  7512.  
  7513. /*--------------------------------------------------------------------------*/
  7514.  
  7515. static void do_parstructnet()
  7516. {
  7517.   Pint i, libid;
  7518.   Pint_list sns;
  7519.   char prom[50];
  7520.  
  7521. #ifdef HP
  7522.   phintererror(1, (char *)NULL, INFORM);
  7523. #else
  7524.   libid = readinteger("archive identifier ? ");
  7525.   sns.num_ints = readposinteger("number of structure networks to archive ? ");
  7526.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
  7527.   for (i = 0; i < sns.num_ints; i++) 
  7528.   {
  7529.     sprintf(prom, "root structure identifier [%d] ? ", i);
  7530.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  7531.   }
  7532.   par_struct_nets(libid, &sns);
  7533.   free(sns.ints);
  7534. #endif
  7535. }  /* do_parstructnet */
  7536.  
  7537. /*--------------------------------------------------------------------------*/
  7538.  
  7539. static void do_pawait_event()
  7540. {
  7541.   Pfloat timeout;
  7542.   Pint ws, devnum;
  7543.   Pin_class class;
  7544.  
  7545.   timeout = readreal("time out (seconds) ? ");
  7546.   pawait_event(timeout, &ws, &class, &devnum);
  7547. }  /* do_pawait_event */
  7548.  
  7549. /*--------------------------------------------------------------------------*/
  7550.  
  7551. static void do_pbuildtran()
  7552. {
  7553.   Ppoint pt;
  7554.   Pvec shift;
  7555.   Pfloat angle;
  7556.   Pvec scale;
  7557.   Pint err;
  7558.  
  7559.   pt = readpoint("fixed point");
  7560.   shift = readvector("shift vector");
  7561.   angle = readreal("rotation angle ? ");
  7562.   scale = readvector("scale vector");
  7563.   pbuild_tran_matrix(&pt, &shift, angle, &scale, &err, tm);
  7564.   if (writeinform)
  7565.   {
  7566.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7567.     if (err == 0)
  7568.     {
  7569.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  7570.       writematrix(PTKEINFORM, tm);
  7571.     }
  7572.     else
  7573.       phigserror(PTKEINFORM, err);
  7574.   }
  7575. }  /* do_pbuildtran */
  7576.  
  7577. /*--------------------------------------------------------------------------*/
  7578.  
  7579. static void do_pbuildtran3()
  7580. {
  7581.   Ppoint3 pt;
  7582.   Pvec3 shift;
  7583.   Pfloat xangle, yangle, zangle;
  7584.   Pvec3 scale;
  7585.   Pint err;
  7586.  
  7587.   pt = readpoint3("fixed point");
  7588.   shift = readvector3("shift vector");
  7589.   xangle = readreal("rotation angle x ? ");
  7590.   yangle = readreal("rotation angle y ? ");
  7591.   zangle = readreal("rotation angle z ? ");
  7592.   scale = readvector3("scale vector");
  7593.   pbuild_tran_matrix3(&pt, &shift, xangle, yangle, zangle, &scale, &err, tm3);
  7594.   if (writeinform)
  7595.   {
  7596.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7597.     if (err == 0)
  7598.     {
  7599.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  7600.       writematrix3(PTKEINFORM, tm3);
  7601.     }
  7602.     else
  7603.       phigserror(PTKEINFORM, err);
  7604.   }
  7605. }  /* do_pbuildtran3 */
  7606.  
  7607. /*--------------------------------------------------------------------------*/
  7608.  
  7609. static void do_pcellarray()
  7610. {
  7611.   Prect rect;
  7612.   Ppat_rep colarray;
  7613.   Pint i;
  7614.  
  7615. #ifdef HP
  7616.   phintererror(1, (char *)NULL, INFORM);
  7617. #else
  7618.   rect.p = readpoint("lower left of cell rectangle");
  7619.   rect.q = readpoint("upper right of cell rectangle");
  7620.   colarray.dims.size_x = readposinteger("number of cell divisions, x ? ");
  7621.   colarray.dims.size_y = readposinteger("number of cell divisions, y ? ");
  7622.   colarray.colr_array = (Pint *)calloc(colarray.dims.size_x *
  7623.                          colarray.dims.size_y, sizeof(Pint));
  7624.   for (i = 0; i < colarray.dims.size_y; i++)
  7625.     readintarray(colarray.dims.size_x, 
  7626.                  &colarray.colr_array[i * colarray.dims.size_x], 
  7627.                  "colour index", PTKECOLOURIND);
  7628.   pcell_array(&rect, &colarray);
  7629.   free(colarray.colr_array);
  7630. #endif
  7631. }  /* do_pcellarray */
  7632.  
  7633. /*--------------------------------------------------------------------------*/
  7634.  
  7635. static void do_pcellarray3()
  7636. {
  7637.   Pparal pgram;
  7638.   Ppat_rep colarray;
  7639.   Pint i;
  7640.  
  7641. #ifdef HP
  7642.   phintererror(1, (char *)NULL, INFORM);
  7643. #else
  7644.   pgram.p = readpoint3("parallelogram, point p");
  7645.   pgram.q = readpoint3("parallelogram, point q");
  7646.   pgram.r = readpoint3("parallelogram, point r");
  7647.   colarray.dims.size_x = readposinteger("number of cell divisions, x ? ");
  7648.   colarray.dims.size_y = readposinteger("number of cell divisions, y ? ");
  7649.   colarray.colr_array = (Pint *)calloc(colarray.dims.size_x *
  7650.                          colarray.dims.size_y, sizeof(Pint));
  7651.   for (i = 0; i < colarray.dims.size_y; i++)
  7652.     readintarray(colarray.dims.size_x, 
  7653.                  &colarray.colr_array[i * colarray.dims.size_x], 
  7654.                  "colour index", PTKECOLOURIND);
  7655.   pcell_array3(&pgram, &colarray);
  7656.   free(colarray.colr_array);
  7657. #endif
  7658. }  /* do_pcellarray3 */
  7659.  
  7660. /*--------------------------------------------------------------------------*/
  7661.  
  7662. static void do_pchangestructid()
  7663. {
  7664.   Pint old, new;
  7665.  
  7666.   old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
  7667.   new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
  7668.   pchange_struct_id(old, new);
  7669. }  /* do_pchangestructid */
  7670.  
  7671. /*--------------------------------------------------------------------------*/
  7672.  
  7673. static void do_pchangestructidref()
  7674. {
  7675.   Pint old, new;
  7676.  
  7677.   old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
  7678.   new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
  7679.   pchange_struct_id_refs(old, new);
  7680. }  /* do_pchangestructidref */
  7681.  
  7682. /*--------------------------------------------------------------------------*/
  7683.  
  7684. static void do_pchangestructref()
  7685. {
  7686.   Pint old, new;
  7687.  
  7688.   old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
  7689.   new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
  7690.   pchange_struct_refs(old, new);
  7691. }  /* do_pchangestructref */
  7692.  
  7693. /*--------------------------------------------------------------------------*/
  7694.  
  7695. static void do_pclosearfile()
  7696. {
  7697.   Pint libid;
  7698.  
  7699.   libid = readinteger("archive identifier ? ");
  7700.   pclose_ar_file(libid);
  7701. }  /* do_pclosearfile */
  7702.  
  7703. /*--------------------------------------------------------------------------*/
  7704.  
  7705. static void do_pclosephigs()
  7706. {
  7707.   pclose_phigs();
  7708. }  /* do_pclosephigs */
  7709.  
  7710. /*--------------------------------------------------------------------------*/
  7711.  
  7712. static void do_pclosestruct()
  7713. {
  7714.   pclose_struct();
  7715. }  /* do_pclosestruct */
  7716.  
  7717. /*--------------------------------------------------------------------------*/
  7718.  
  7719. static void do_pclosews()
  7720. {
  7721.   Pint wsid;
  7722.  
  7723.   wsid = readinteger("workstation identifier ? ");
  7724.   pclose_ws(wsid);
  7725. }  /* do_pclosews */
  7726.  
  7727. /*--------------------------------------------------------------------------*/
  7728.  
  7729. static void do_pcomposematrix()
  7730. {
  7731.   Pmatrix a, b;
  7732.   Pint err;
  7733.  
  7734.   readmatrix(a, "matrix a");
  7735.   readmatrix(b, "matrix b");
  7736.   pcompose_matrix(a, b, &err, tm);
  7737.   if (writeinform)
  7738.   {
  7739.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7740.     if (err == 0)
  7741.     {
  7742.       phinprintf(PTKEINFORM, "composed transformation matrix:\n");
  7743.       writematrix(PTKEINFORM, tm);
  7744.     }
  7745.     else
  7746.       phigserror(PTKEINFORM, err);
  7747.   }
  7748. }  /* do_pcomposematrix */
  7749.  
  7750. /*--------------------------------------------------------------------------*/
  7751.  
  7752. static void do_pcomposematrix3()
  7753. {
  7754.   Pmatrix3 a, b;
  7755.   Pint err;
  7756.  
  7757.   readmatrix3(a, "matrix a");
  7758.   readmatrix3(b, "matrix b");
  7759.   pcompose_matrix3(a, b, &err, tm3);
  7760.   if (writeinform)
  7761.   {
  7762.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7763.     if (err == 0)
  7764.     {
  7765.       phinprintf(PTKEINFORM, "composed transformation matrix:\n");
  7766.       writematrix3(PTKEINFORM, tm3);
  7767.     }
  7768.     else
  7769.       phigserror(PTKEINFORM, err);
  7770.   }
  7771. }  /* do_pcomposematrix3 */
  7772.  
  7773. /*--------------------------------------------------------------------------*/
  7774.  
  7775. static void do_pcomposetran()
  7776. {
  7777.   Ppoint pt;
  7778.   Pvec shift;
  7779.   Pfloat angle;
  7780.   Pvec scale;
  7781.   Pint err;
  7782.   Pmatrix matrix;
  7783.  
  7784.   readmatrix(matrix, "matrix");
  7785.   pt = readpoint("fixed point");
  7786.   shift = readvector("shift vector");
  7787.   angle = readreal("rotation angle ? ");
  7788.   scale = readvector("scale vector");
  7789.   pcompose_tran_matrix(matrix, &pt, &shift, angle, &scale, &err, tm);
  7790.   if (writeinform)
  7791.   {
  7792.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7793.     if (err == 0)
  7794.     {
  7795.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  7796.       writematrix(PTKEINFORM, tm);
  7797.     }
  7798.     else
  7799.       phigserror(PTKEINFORM, err);
  7800.   }
  7801. }  /* do_pcomposetran */
  7802.  
  7803. /*--------------------------------------------------------------------------*/
  7804.  
  7805. static void do_pcomposetran3()
  7806. {
  7807.   Ppoint3 pt;
  7808.   Pvec3 shift;
  7809.   Pfloat xangle, yangle, zangle;
  7810.   Pvec3 scale;
  7811.   Pint err;
  7812.   Pmatrix3 matrix, tm3;
  7813.  
  7814.   readmatrix3(matrix, "matrix");
  7815.   pt = readpoint3("fixed point");
  7816.   shift = readvector3("shift vector");
  7817.   xangle = readreal("rotation angle x ? ");
  7818.   yangle = readreal("rotation angle y ? ");
  7819.   zangle = readreal("rotation angle z ? ");
  7820.   scale = readvector3("scale vector");
  7821.   pcompose_tran_matrix3(matrix, &pt, &shift, xangle, yangle, zangle, &scale, 
  7822.                 &err, tm3);
  7823.   if (writeinform)
  7824.   {
  7825.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7826.     if (err == 0)
  7827.     {
  7828.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  7829.       writematrix3(PTKEINFORM, tm3);
  7830.     }
  7831.     else
  7832.       phigserror(PTKEINFORM, err);
  7833.   }
  7834. }  /* do_pcomposetran3 */
  7835.  
  7836. /*--------------------------------------------------------------------------*/
  7837.  
  7838. static void do_pcopyallelemsstruct()
  7839. {
  7840.   pcopy_all_elems_struct(readintvalue("structure identifier to copy ? ", 
  7841.                       PTKESTRUCTID));
  7842. }  /* do_pcopyallelemsstruct */
  7843.  
  7844. /*--------------------------------------------------------------------------*/
  7845.  
  7846. static void do_pdelallstruct()
  7847. {
  7848.   pdel_all_structs();
  7849. }  /* do_pdelallstruct */
  7850.  
  7851. /*--------------------------------------------------------------------------*/
  7852.  
  7853. static void do_pdelallstructar()
  7854. {
  7855.   pdel_all_structs_ar(readinteger("archive identifier ? "));
  7856. }  /* pdel_all_structs_ar */
  7857.  
  7858. /*--------------------------------------------------------------------------*/
  7859.  
  7860. static void do_pdelelem()
  7861. {
  7862.   pdel_elem();
  7863. }  /* do_pdelelem() */
  7864.  
  7865. /*--------------------------------------------------------------------------*/
  7866.  
  7867. static void do_pdelelemrange()
  7868. {
  7869.   Pint e1, e2;
  7870.  
  7871.   e1 = readinteger("element to start ? ");
  7872.   e2 = readinteger("element to finish ? ");
  7873.   pdel_elem_range(e1, e2);
  7874. }  /* do_pdelelemrange */
  7875.  
  7876. /*--------------------------------------------------------------------------*/
  7877.  
  7878. static void do_pdelelemslabels()
  7879. {
  7880.   Pint s1, s2;
  7881.  
  7882.   s1 = readintvalue("start label ? ", PTKELABELVAL);
  7883.   s2 = readintvalue("finish label ? ", PTKELABELVAL);
  7884.   pdel_elems_labels(s1, s2);
  7885. }  /* do_pdelelemslabels */
  7886.  
  7887. /*--------------------------------------------------------------------------*/
  7888.  
  7889. static void do_pdelstruct()
  7890. {
  7891.   pdel_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
  7892. }  /* do_pdelstruct() */
  7893.  
  7894. /*--------------------------------------------------------------------------*/
  7895.  
  7896. static void do_pdelstructar()
  7897. {
  7898.   Pint i, libid;
  7899.   Pint_list sns;
  7900.   char prom[30];
  7901.  
  7902. #ifdef HP
  7903.   phintererror(1, (char *)NULL, INFORM);
  7904. #else
  7905.   libid = readinteger("archive identifier ? ");
  7906.   sns.num_ints = readposinteger("number of structures to delete ? ");
  7907.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
  7908.   for (i = 0; i < sns.num_ints; i++) 
  7909.   {
  7910.     sprintf(prom, "structure identifier [%d] ? ", i);
  7911.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  7912.   }
  7913.   pdel_structs_ar(libid, &sns);
  7914.   free(sns.ints);
  7915. #endif
  7916. }  /* do_pdelstructar */
  7917.  
  7918. /*--------------------------------------------------------------------------*/
  7919.  
  7920. static void do_pdelstructnet()
  7921. {
  7922.   Pint delstid;
  7923.   Pref_flag refflag;
  7924.  
  7925.   delstid = readintvalue("root structure identifier ? ", PTKESTRUCTID);
  7926.   refflag = readphigsenum(PTKEREFF, "reference handling flag ? ");
  7927.   pdel_struct_net(delstid, refflag);
  7928. }  /* do_pdelstructnet */
  7929.  
  7930. /*--------------------------------------------------------------------------*/
  7931.  
  7932. static void do_pdelstructnetar()
  7933. {
  7934.   Pint i, libid;
  7935.   Pint_list sns;
  7936.   char prom[30];
  7937.  
  7938. #ifdef HP
  7939.   phintererror(1, (char *)NULL, INFORM);
  7940. #else
  7941.   libid = readinteger("archive identifier ? ");
  7942.   sns.num_ints = readposinteger("number of structures to delete ? ");
  7943.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
  7944.   for (i = 0; i < sns.num_ints; i++) 
  7945.   {
  7946.     sprintf(prom, "structure identifier [%d] ? ", i);
  7947.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  7948.   }
  7949.   pdel_struct_nets_ar(libid, &sns);
  7950.   free(sns.ints);
  7951. #endif
  7952. }  /* do_pdelstructnetar */
  7953.  
  7954. /*--------------------------------------------------------------------------*/
  7955.  
  7956. static void do_pelemsrch()
  7957. {
  7958.   Pint stid, elptr;
  7959.   Psearch_dir dir;
  7960.   Pelem_type_list incl;
  7961.   Pelem_type_list excl;
  7962.   Pelem_type inclnames[255];
  7963.   Pelem_type exclnames[255];
  7964.   Pint err, foundel;
  7965.   Psearch_status status;
  7966.  
  7967.   stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
  7968.   elptr = readinteger("starting element pointer ? ");
  7969.   dir = readphigsenum(PTKESRCHDIR, "search direction ? ");
  7970.   incl.elem_types = inclnames;
  7971.   excl.elem_types = exclnames;
  7972.   incl.num_elem_types = readposinteger("length of element inclusion set ? ");
  7973.   readenumlist(incl.num_elem_types, incl.elem_types, PTKESRCHELTYPE, 
  7974.                "element inclusion set");
  7975.   excl.num_elem_types = readposinteger("length of element exclusion set ? ");
  7976.   readenumlist(excl.num_elem_types, excl.elem_types, PTKESRCHELTYPE, 
  7977.                "element exclusion set");
  7978.   pelem_search(stid, elptr, dir, &incl, &excl, &err, &status, &foundel);
  7979.   if (writeinform)
  7980.   {
  7981.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  7982.     if (err == 0)
  7983.     {
  7984.       phinprintf(PTKEINFORM, "search status = ");
  7985.       writephigsenum(PTKEINFORM, PTKESRCHSTATUS, status);
  7986.       phinprintf(PTKEINFORM, "element number = ");
  7987.       writeinteger(PTKEINFORM, foundel);
  7988.     }
  7989.     else
  7990.       phigserror(PTKEINFORM, err);
  7991.   } 
  7992. }  /* do_pelemsrch */
  7993.  
  7994. /*--------------------------------------------------------------------------*/
  7995.  
  7996. static void do_pemergencyclosephigs()
  7997. {
  7998.   pemergency_close_phigs();
  7999. }  /* do_pemergencyclosephigs */
  8000.  
  8001. /*--------------------------------------------------------------------------*/
  8002.  
  8003. static void do_pemptystruct()
  8004. {
  8005.   pempty_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
  8006. }  /* do_pemptystruct */
  8007.  
  8008. /*--------------------------------------------------------------------------*/
  8009.  
  8010. static void do_perrorhand()
  8011. {
  8012.   Pint err_num, func_num;
  8013.   char err_file[80];
  8014.  
  8015.   err_num = readinteger("error number ? ");
  8016.   func_num = readinteger("function number ? ");
  8017.   readstring(err_file, "error file name ? ");
  8018.   perr_hand(err_num, func_num, err_file);
  8019. }  /* do_perrorhand */
  8020.  
  8021. /*--------------------------------------------------------------------------*/
  8022.  
  8023. static void do_perrorlog()
  8024. {
  8025.   Pint err_num, func_num;
  8026.   char err_file[80];
  8027.  
  8028.   err_num = readinteger("error number ? ");
  8029.   func_num = readinteger("function number ? ");
  8030.   readstring(err_file, "error file name ? ");
  8031.   perr_log(err_num, func_num, err_file);
  8032. }  /* do_perrorlog */
  8033.  
  8034. /*--------------------------------------------------------------------------*/
  8035.  
  8036. static void do_pescape()
  8037. {
  8038.   phintererror(3, (char *)NULL, INFORM);
  8039. }  /* do_pescape */
  8040.  
  8041. /*--------------------------------------------------------------------------*/
  8042.  
  8043. static void do_pevalviewmappingmatrix()
  8044. {
  8045.   Pview_map mapping;
  8046.   Pint err;
  8047.  
  8048.   mapping.win = readlimit("window limits");
  8049.   mapping.proj_vp = readlimit("viewport limits");
  8050.   peval_view_map_matrix(&mapping, &err, vmm);
  8051.   if (writeinform)
  8052.   {
  8053.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8054.     if (err == 0)
  8055.     {
  8056.       phinprintf(PTKEINFORM, "view mapping matrix:\n");
  8057.       writematrix(PTKEINFORM, vmm);
  8058.     }
  8059.     else
  8060.       phigserror(PTKEINFORM, err);
  8061.   }
  8062. }  /* do_pevalviewmappingmatrix */
  8063.  
  8064. /*--------------------------------------------------------------------------*/
  8065.  
  8066. static void do_pevalviewmappingmatrix3()
  8067. {
  8068.   Pview_map3 mapping;
  8069.   Pint err;
  8070.  
  8071.   mapping.win = readlimit("window limits");
  8072.   mapping.proj_vp = readlimit3("viewport limits");
  8073.   mapping.proj_type = readphigsenum(PTKEPROJTYPE, "projection type ? ");
  8074.   mapping.proj_ref_point = readpoint3("projection reference point");
  8075.   mapping.view_plane = readreal("view plane distance ? ");
  8076.   mapping.back_plane = readreal("back plane distance ? ");
  8077.   mapping.front_plane = readreal("front plane distance ? ");
  8078.   peval_view_map_matrix3(&mapping, &err, vmm3);
  8079.   if (writeinform)
  8080.   {
  8081.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8082.     if (err == 0)
  8083.     {
  8084.       phinprintf(PTKEINFORM, "view mapping matrix:\n");
  8085.       writematrix3(PTKEINFORM, vmm3);
  8086.     }
  8087.     else
  8088.       phigserror(PTKEINFORM, err);
  8089.   }
  8090. }  /* do_pevalviewmappingmatrix3 */
  8091.  
  8092. /*--------------------------------------------------------------------------*/
  8093.  
  8094. static void do_pevalvieworientationmatrix()
  8095. {
  8096.   Ppoint vrp;
  8097.   Pvec vup;
  8098.   Pint err;
  8099.  
  8100.   vrp = readpoint("view reference point");
  8101.   vup = readvector("view up vector");
  8102.   peval_view_ori_matrix(&vrp, &vup, &err, vom);
  8103.   if (writeinform)
  8104.   {
  8105.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8106.     if (err == 0)
  8107.     {
  8108.       phinprintf(PTKEINFORM, "view orientation matrix:\n");
  8109.       writematrix(PTKEINFORM, vom);
  8110.     }
  8111.     else
  8112.       phigserror(PTKEINFORM, err);
  8113.   }
  8114. }  /* do_pevalvieworientationmatrix */
  8115.  
  8116. /*--------------------------------------------------------------------------*/
  8117.  
  8118. static void do_pevalvieworientationmatrix3()
  8119. {
  8120.   Ppoint3 vrp;
  8121.   Pvec3 vup, vpn;
  8122.   Pint err;
  8123.  
  8124.   vrp = readpoint3("view reference point");
  8125.   vpn = readvector3("view plane normal");
  8126.   vup = readvector3("view up vector");
  8127.   peval_view_ori_matrix3(&vrp, &vpn, &vup, &err, vom3);
  8128.   if (writeinform)
  8129.   {
  8130.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8131.     if (err == 0)
  8132.     {
  8133.       phinprintf(PTKEINFORM, "view orientation matrix:\n");
  8134.       writematrix3(PTKEINFORM, vom3);
  8135.     }
  8136.     else
  8137.       phigserror(PTKEINFORM, err);
  8138.   }
  8139. }  /* do_pevalvieworientationmatrix3 */
  8140.  
  8141. /*--------------------------------------------------------------------------*/
  8142.  
  8143. static void do_pexecutestruct()
  8144. {
  8145.   pexec_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
  8146. }  /* do_pexecutestruct */
  8147.  
  8148. /*--------------------------------------------------------------------------*/
  8149.  
  8150. static void do_pfillarea()
  8151. {
  8152.   Ppoint_list pts;
  8153.  
  8154.   pts.num_points = readposinteger("number of points ? ");
  8155.   pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
  8156.   readpointarray(pts.num_points, pts.points);
  8157.   pfill_area(&pts);
  8158.   free(pts.points);
  8159. }  /* do_pfillarea */
  8160.  
  8161. /*--------------------------------------------------------------------------*/
  8162.  
  8163. static void do_pfillarea3()
  8164. {
  8165.   Ppoint_list3 pts;
  8166.  
  8167.   pts.num_points = readposinteger("number of points ? ");
  8168.   pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
  8169.   readpoint3array(pts.num_points, pts.points);
  8170.   pfill_area3(&pts);
  8171.   free(pts.points);
  8172. }  /* do_pfillarea3 */
  8173.  
  8174. /*--------------------------------------------------------------------------*/
  8175.  
  8176. static void do_pfillareaset()
  8177. {
  8178.   Pint nb;
  8179.   Pint i, totalpts;
  8180.   Ppoint_list *sets;
  8181.  
  8182.   nb = readposinteger("number of sets? ");
  8183.   sets = (Ppoint_list *)calloc(nb, sizeof(Ppoint_list));  
  8184.   for (i = 0; i < nb; i++)
  8185.   {
  8186.     readpointlst(&sets[i]);
  8187.   }
  8188.   ptk_fillareaset(nb, sets);
  8189.   for (i = 0; i < nb; i++)
  8190.   {
  8191.     free(sets[i].points);
  8192.   }
  8193.   free(sets);
  8194. }  /* do_pfillareaset */
  8195.  
  8196. /*--------------------------------------------------------------------------*/
  8197.  
  8198. static void do_pfillareaset3()
  8199. {
  8200.   Pint nb;
  8201.   Pint i, totalpts;
  8202.   Ppoint_list3 *sets;
  8203.  
  8204.   nb = readposinteger("number of sets? ");
  8205.   sets = (Ppoint_list3 *)calloc(nb, sizeof(Ppoint_list3));  
  8206.   for (i = 0; i < nb; i++)
  8207.   {
  8208.     readpointlst3(&sets[i]);
  8209.   }
  8210.   ptk_fillareaset3(nb, sets);
  8211.   for (i = 0; i < nb; i++)
  8212.   {
  8213.     free(sets[i].points);
  8214.   }
  8215.   free(sets);
  8216. }  /* do_pfillareaset3 */
  8217.  
  8218. /*--------------------------------------------------------------------------*/
  8219.  
  8220. static void do_pflush_events()
  8221. {
  8222.   Pint ws, dev;
  8223.   Pin_class class;
  8224.  
  8225.   ws = readinteger("workstation identifier ? ");
  8226.   class = readphigsenum(PTKEICLASS, "device class ? ");
  8227.   dev = readinteger("input device number ? ");
  8228.   pflush_events(ws, class, dev);
  8229. }  /* do_pflush_events */
  8230.  
  8231. /*--------------------------------------------------------------------------*/
  8232.  
  8233. static void do_pgdp()
  8234. {
  8235.   Pint gdpid, i;
  8236.   Ppoint_list pts;
  8237.   Pgdp_data gdprec;
  8238.  
  8239.   pts.num_points = readposinteger("number of points ? ");
  8240.   pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
  8241.   readpointarray(pts.num_points, pts.points);
  8242.   gdpid = readinteger("gdp function identifier ? ");
  8243.   switch (gdpid)
  8244.   {
  8245. #ifdef SUN
  8246.     case -2:
  8247.       gdprec.gdp_u2.center = readpoint("circle centre");
  8248.       gdprec.gdp_u2.radius = readreal("circle radius ? ");
  8249.       break;
  8250.  
  8251.     case -3:
  8252.       gdprec.gdp_u3.center = readpoint("circle centre");
  8253.       gdprec.gdp_u3.radius = readreal("circle radius ? ");
  8254.       gdprec.gdp_u3.st_ang = readreal("start angle ? ");
  8255.       gdprec.gdp_u3.end_ang = readreal("end angle ? ");
  8256.       break;
  8257.  
  8258.     case -4:
  8259.       gdprec.gdp_u4.center = readpoint("circle centre");
  8260.       gdprec.gdp_u4.radius = readreal("circle radius ? ");
  8261.       gdprec.gdp_u4.st_ang = readreal("start angle ? ");
  8262.       gdprec.gdp_u4.end_ang = readreal("end angle ? ");
  8263.       gdprec.gdp_u4.cls_type = readinteger("close type ? ");
  8264.       break;
  8265.  
  8266.     case -5:
  8267.       gdprec.gdp_u5.center = readpoint("circle centre");
  8268.       gdprec.gdp_u5.radius = readreal("circle radius ? ");
  8269.       break;
  8270.  
  8271.     case -6:
  8272.       gdprec.gdp_u6.center = readpoint("circle centre");
  8273.       gdprec.gdp_u6.radius = readreal("circle radius ? ");
  8274.       gdprec.gdp_u6.st_ang = readreal("start angle ? ");
  8275.       gdprec.gdp_u6.end_ang = readreal("end angle ? ");
  8276.       break;
  8277.  
  8278.     case -7:
  8279.       gdprec.gdp_u7.center = readpoint("circle centre");
  8280.       gdprec.gdp_u7.radius = readreal("circle radius ? ");
  8281.       gdprec.gdp_u7.st_ang = readreal("start angle ? ");
  8282.       gdprec.gdp_u7.end_ang = readreal("end angle ? ");
  8283.       gdprec.gdp_u7.cls_type = readinteger("close type ? ");
  8284.       break;
  8285.  
  8286.     case -8:
  8287.       gdprec.gdp_u8.center = readpoint("ellipse centre");
  8288.       gdprec.gdp_u8.major = readvector("major axis");
  8289.       gdprec.gdp_u8.minor = readvector("minor axis");
  8290.       break;
  8291.  
  8292.     case -9:
  8293.       gdprec.gdp_u9.center = readpoint("ellipse centre");
  8294.       gdprec.gdp_u9.major = readvector("major axis");
  8295.       gdprec.gdp_u9.minor = readvector("minor axis");
  8296.       gdprec.gdp_u9.st_ang = readreal("start angle ? ");
  8297.       gdprec.gdp_u9.end_ang = readreal("end angle ? ");
  8298.       break;
  8299.  
  8300.     case -10:
  8301.       gdprec.gdp_u10.center = readpoint("ellipse centre");
  8302.       gdprec.gdp_u10.major = readvector("major axis");
  8303.       gdprec.gdp_u10.minor = readvector("minor axis");
  8304.       gdprec.gdp_u10.st_ang = readreal("start angle ? ");
  8305.       gdprec.gdp_u10.end_ang = readreal("end angle ? ");
  8306.       gdprec.gdp_u10.cls_type = readinteger("close type ? ");
  8307.       break;
  8308.  
  8309.     case -11:
  8310.       gdprec.gdp_u11.center = readpoint("ellipse centre");
  8311.       gdprec.gdp_u11.major = readvector("major axis");
  8312.       gdprec.gdp_u11.minor = readvector("minor axis");
  8313.       break;
  8314.  
  8315.     case -12:
  8316.       gdprec.gdp_u12.center = readpoint("ellipse centre");
  8317.       gdprec.gdp_u12.major = readvector("major axis");
  8318.       gdprec.gdp_u12.minor = readvector("minor axis");
  8319.       gdprec.gdp_u12.st_ang = readreal("start angle ? ");
  8320.       gdprec.gdp_u12.end_ang = readreal("end angle ? ");
  8321.       break;
  8322.  
  8323.     case -13:
  8324.       gdprec.gdp_u13.center = readpoint("ellipse centre");
  8325.       gdprec.gdp_u13.major = readvector("major axis");
  8326.       gdprec.gdp_u13.minor = readvector("minor axis");
  8327.       gdprec.gdp_u13.st_ang = readreal("start angle ? ");
  8328.       gdprec.gdp_u13.end_ang = readreal("end angle ? ");
  8329.       gdprec.gdp_u13.cls_type = readinteger("close type ? ");
  8330.       break;
  8331.  
  8332.     case -14:
  8333.       break;
  8334. #endif
  8335.   }
  8336.   pgdp(&pts, gdpid, &gdprec);
  8337. }  /* do_pgdp */
  8338.  
  8339. /*--------------------------------------------------------------------------*/
  8340.  
  8341. static void do_pgdp3()
  8342. {
  8343. #ifdef SUN
  8344.   phintererror(3, (char *)NULL, INFORM);
  8345. #endif
  8346. #ifdef VMS
  8347.   phintererror(1, (char *)NULL, INFORM);
  8348. #endif
  8349. }  /* do_pgdp3 */
  8350.  
  8351. /*--------------------------------------------------------------------------*/
  8352.  
  8353. static void do_pgse()
  8354. {
  8355. #ifdef SUN
  8356.   phintererror(3, (char *)NULL, INFORM);
  8357. #endif
  8358. #ifdef VMS
  8359.   phintererror(1, (char *)NULL, INFORM);
  8360. #endif
  8361. }  /* do_pgse */
  8362.  
  8363. /*--------------------------------------------------------------------------*/
  8364.  
  8365. static void do_pget_choice()
  8366. {
  8367.   Pin_status status;
  8368.   Pint choice;
  8369.  
  8370.   pget_choice(&status, &choice);
  8371.   if (writeinform)
  8372.   {
  8373.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8374.     phinprintf(PTKEINFORM, "status of request = ");
  8375.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  8376.     if (status == PIN_STATUS_OK)
  8377.     {
  8378.       phinprintf(PTKEINFORM, "choice = ");
  8379.       writeinteger(PTKEINFORM, choice);
  8380.     }
  8381.   }
  8382. }  /* do_pget_choice */
  8383.  
  8384. /*--------------------------------------------------------------------------*/
  8385.  
  8386. static void do_pgettypemf()
  8387. {
  8388.   phintererror(1, (char *)NULL, INFORM);
  8389. }  /* do_pgettypemf */
  8390.  
  8391. /*--------------------------------------------------------------------------*/
  8392.  
  8393. static void do_pget_loc()
  8394. {
  8395.   Pint view_index;
  8396.   Ppoint pos;
  8397.  
  8398.   pget_loc(&view_index, &pos);
  8399.   if (writeinform)
  8400.   {
  8401.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8402.     phinprintf(PTKEINFORM, "view index = ");
  8403.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  8404.     phinprintf(PTKEINFORM, "point:\n");
  8405.     writepoint(PTKEINFORM, &pos);
  8406.   }
  8407. }  /* do_pget_loc */
  8408.  
  8409. /*--------------------------------------------------------------------------*/
  8410.  
  8411. static void do_pget_loc3()
  8412. {
  8413.   Pint view_index;
  8414.   Ppoint3 pos;
  8415.  
  8416.   pget_loc3(&view_index, &pos);
  8417.   if (writeinform)
  8418.   {
  8419.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8420.     phinprintf(PTKEINFORM, "view index = ");
  8421.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  8422.     phinprintf(PTKEINFORM, "point:\n");
  8423.     writepoint3(PTKEINFORM, &pos);
  8424.   }
  8425. }  /* do_pget_loc3 */
  8426.  
  8427. /*--------------------------------------------------------------------------*/
  8428.  
  8429. static void do_pget_pick()
  8430. {
  8431.   Pint depth;
  8432.   Pin_status status;
  8433.   Ppick_path pick;
  8434.  
  8435.   depth = readposinteger("depth of pick path ? ");
  8436.   pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
  8437.   pick.depth = depth;
  8438.   pget_pick(depth, &status, &pick);
  8439.   if (writeinform)
  8440.   {
  8441.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8442.     phinprintf(PTKEINFORM, "status of request");
  8443.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  8444.     if (status == PIN_STATUS_OK)
  8445.     {
  8446.       phinprintf(PTKEINFORM, "pick path:\n");
  8447.       writepickpath(PTKEINFORM, &pick.path_list); 
  8448.     }
  8449.   }
  8450.   free(pick.path_list);
  8451. }  /* do_pget_pick */
  8452.  
  8453. /*--------------------------------------------------------------------------*/
  8454.  
  8455. static void do_pget_string()
  8456. {
  8457.   char string[255];
  8458.  
  8459.   pget_string(string);
  8460.   if (writeinform)
  8461.   {
  8462.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8463.     phinprintf(PTKEINFORM, "string = \"%s\"\n", string); 
  8464.   }
  8465. }  /* do_pget_string */
  8466.  
  8467. /*--------------------------------------------------------------------------*/
  8468.  
  8469. static void do_pget_stroke()
  8470. {
  8471.   Pint view_index;
  8472.   Ppoint_list stroke;
  8473.   Ppoint pts[255];
  8474.  
  8475.   stroke.points = pts;
  8476.   pget_stroke(&view_index, &stroke);
  8477.   if (writeinform)
  8478.   {
  8479.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8480.     phinprintf(PTKEINFORM, "view index = ");
  8481.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  8482.     phinprintf(PTKEINFORM, "number of points = ");
  8483.     writeinteger(PTKEINFORM, stroke.num_points);
  8484.     phinprintf(PTKEINFORM, "points:\n");
  8485.     writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
  8486.   }
  8487. }  /* do_pget_stroke */
  8488.  
  8489. /*--------------------------------------------------------------------------*/
  8490.  
  8491. static void do_pget_stroke3()
  8492. {
  8493.   Pint view_index;
  8494.   Ppoint_list3 stroke;
  8495.   Ppoint3 pts[255];
  8496.  
  8497.   stroke.points = pts;
  8498.   pget_stroke3(&view_index, &stroke);
  8499.   if (writeinform)
  8500.   {
  8501.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8502.     phinprintf(PTKEINFORM, "view index = ");
  8503.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  8504.     phinprintf(PTKEINFORM, "number of points = ");
  8505.     writeinteger(PTKEINFORM, stroke.num_points);
  8506.     phinprintf(PTKEINFORM, "points:\n");
  8507.     writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
  8508.   }
  8509. }  /* do_pget_stroke3 */
  8510.  
  8511. /*--------------------------------------------------------------------------*/
  8512.  
  8513. static void do_pget_val()
  8514. {
  8515.   Pfloat val;
  8516.  
  8517.   pget_val(&val);
  8518.   if (writeinform)
  8519.   {
  8520.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8521.     phinprintf(PTKEINFORM, "value = ");
  8522.     writereal(PTKEINFORM, val);
  8523.   }
  8524. }  /* do_pget_val */
  8525.  
  8526. /*--------------------------------------------------------------------------*/
  8527.  
  8528. static void do_pincrspasrch()
  8529. {
  8530.   Ppoint ref;
  8531.   Pfloat dist;
  8532.   Pelem_ref_list sp, fp;
  8533.   Pint ceil, len, st, err, totlen, i;
  8534.   Pfilter_list norm, inv;
  8535.   Pclip_ind clipflag;
  8536.  
  8537. #ifdef HP
  8538.   phintererror(1, (char *)NULL, INFORM);
  8539. #else
  8540.   ref = readpoint("search reference point");
  8541.   dist = readreal("search distance ? ");
  8542.   readexecreflst(&sp, "starting path list");
  8543.   clipflag = readphigsenum(PTKECLIP, "model clip flag ? ");
  8544.   ceil = readinteger("search ceiling index ? ");
  8545.   readfilterlst(&norm, "normal filter list");
  8546.   readfilterlst(&inv, "inverted filter list");
  8547.   st = readposinteger("starting position ? ");
  8548.   pincr_spa_search(&ref, dist, &sp, clipflag,
  8549.                    ceil, &norm, &inv, 0, st, &err, &fp, &totlen);
  8550.   fp.elem_refs = (Pelem_ref *)calloc(totlen, sizeof(Pelem_ref));
  8551.   pincr_spa_search(&ref, dist, &sp, clipflag, 
  8552.                    ceil, &norm, &inv, totlen, st, &err, &fp, &totlen);
  8553.   if (writeinform)
  8554.   {
  8555.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8556.     if (err == 0)
  8557.     {
  8558.       for (i = 0; i < totlen; i++)
  8559.       {
  8560.         phinprintf(PTKEINFORM, "structure identifier = ");
  8561.         writeintvalue(PTKEINFORM, fp.elem_refs[i].struct_id, PTKESTRUCTID);
  8562.         phinprintf(PTKEINFORM, "element number = ");
  8563.         writeinteger(PTKEINFORM, fp.elem_refs[i].elem_pos);
  8564.       }
  8565.     }
  8566.     else
  8567.       phigserror(PTKEINFORM, err);
  8568.   }
  8569. #endif
  8570. }  /* do_pincrspasrch */
  8571.  
  8572. /*--------------------------------------------------------------------------*/
  8573.  
  8574. static void do_pincrspasrch3()
  8575. {
  8576.   Ppoint3 ref;
  8577.   Pfloat dist;
  8578.   Pelem_ref_list sp, fp;
  8579.   Pint ceil, len, st, err, totlen, i;
  8580.   Pfilter_list norm, inv;
  8581.   Pclip_ind clipflag;
  8582.  
  8583. #ifdef HP
  8584.   phintererror(1, (char *)NULL, INFORM);
  8585. #else
  8586.   ref = readpoint3("search reference point");
  8587.   dist = readreal("search distance ? ");
  8588.   readexecreflst(&sp, "starting path list");
  8589.   clipflag = readphigsenum(PTKECLIP, "model clip flag ? ");
  8590.   ceil = readinteger("search ceiling index ? ");
  8591.   readfilterlst(&norm, "normal filter list");
  8592.   readfilterlst(&inv, "inverted filter list");
  8593.   st = readposinteger("starting position ? ");
  8594.   pincr_spa_search3(&ref, dist, &sp, clipflag, 
  8595.                     ceil, &norm, &inv, 0, st, &err, &fp, &totlen);
  8596.   fp.elem_refs = (Pelem_ref *)calloc(totlen, sizeof(Pelem_ref));
  8597.   pincr_spa_search3(&ref, dist, &sp, clipflag, 
  8598.                     ceil, &norm, &inv, totlen, st, &err, &fp, &totlen);
  8599.   if (writeinform)
  8600.   {
  8601.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  8602.     if (err == 0)
  8603.     {
  8604.       for (i = 0; i < totlen; i++)
  8605.       {
  8606.         phinprintf(PTKEINFORM, "structure identifier = ");
  8607.         writeintvalue(PTKEINFORM, fp.elem_refs[i].struct_id, PTKESTRUCTID);
  8608.         phinprintf(PTKEINFORM, "element number = ");
  8609.         writeinteger(PTKEINFORM, fp.elem_refs[i].elem_pos);
  8610.       }
  8611.     }
  8612.     else
  8613.       phigserror(PTKEINFORM, err);
  8614.   }
  8615. #endif
  8616. }  /* do_pincrspasrch3 */
  8617.  
  8618. /*--------------------------------------------------------------------------*/
  8619.  
  8620. static void do_pinit_choice()
  8621. {
  8622.   Pint wsid, dev, init, pet;
  8623.   Pin_status status;
  8624.   Plimit echo;
  8625.   Pchoice_data record;
  8626.  
  8627.   wsid = readinteger("workstation identifier ? ");
  8628.   dev = readinteger("choice device number ? ");
  8629.   status = readphigsenum(PTKEISTATUS, "initial choice status ? ");
  8630.   init = readposinteger("initial choice ? ");
  8631.   pet = readinteger("prompt and echo type ? ");
  8632.   echo = readlimit("echo area");
  8633.   readchoicerec(dev, pet, &record);
  8634.   pinit_choice(wsid, dev, status, init, pet, &echo, &record);
  8635. }  /* do_pinit_choice */
  8636.  
  8637. /*--------------------------------------------------------------------------*/
  8638.  
  8639. static void do_pinit_choice3()
  8640. {
  8641.   Pint wsid, dev, init, pet;
  8642.   Pin_status status;
  8643.   Plimit3 echo;
  8644.   Pchoice_data record;
  8645.  
  8646.   wsid = readinteger("workstation identifier ? ");
  8647.   dev = readinteger("choice device number ? ");
  8648.   status = readphigsenum(PTKEISTATUS, "initial choice status ? ");
  8649.   init = readposinteger("initial choice ? ");
  8650.   pet = readinteger("prompt and echo type ? ");
  8651.   echo = readlimit3("echo volume");
  8652.   readchoicerec3(dev, pet, &record);
  8653.   pinit_choice3(wsid, dev, status, init, pet, &echo, &record);
  8654. }  /* do_pinit_choice3 */
  8655.  
  8656. /*--------------------------------------------------------------------------*/
  8657.  
  8658. static void do_pinit_loc()
  8659. {
  8660.   Pint wsid, dev, pet, initview;
  8661.   Ppoint initpos;
  8662.   Plimit echo;
  8663.   Ploc_data record;
  8664.  
  8665.   wsid = readinteger("workstation identifier ? ");
  8666.   dev = readinteger("locator device number ? ");
  8667.   initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
  8668.   initpos = readpoint("initial position");
  8669.   pet = readinteger("prompt and echo type ? ");
  8670.   echo = readlimit("echo area");
  8671.   readlocrec(dev, pet, &record);
  8672.   pinit_loc(wsid, dev, initview, &initpos, pet, &echo, &record);
  8673. }  /* do_pinit_loc */
  8674.  
  8675. /*--------------------------------------------------------------------------*/
  8676.  
  8677. static void do_pinit_loc3()
  8678. {
  8679.   Pint wsid, dev, pet, initview;
  8680.   Ppoint3 initpos;
  8681.   Plimit3 echo;
  8682.   Ploc_data record;
  8683.  
  8684.   wsid = readinteger("workstation identifier ? ");
  8685.   dev = readinteger("locator device number ? ");
  8686.   initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
  8687.   initpos = readpoint3("initial position");
  8688.   pet = readinteger("prompt and echo type ? ");
  8689.   echo = readlimit3("echo volume");
  8690.   readlocrec3(dev, pet, &record);
  8691.   pinit_loc3(wsid, dev, initview, &initpos, pet, &echo, &record);
  8692. }  /* do_pinit_loc3 */
  8693.  
  8694. /*--------------------------------------------------------------------------*/
  8695.  
  8696. static void do_pinit_pick()
  8697. {
  8698.   Pint wsid, dev, pet;
  8699.   Pin_status status;
  8700.   Ppick_path init;
  8701.   Plimit echo;
  8702.   Ppick_data record;
  8703.   Ppath_order order;
  8704.  
  8705.   wsid = readinteger("workstation identifier ? ");
  8706.   dev = readinteger("pick device number ? ");
  8707.   status = readphigsenum(PTKEISTATUS, "initial pick status ? ");
  8708.   readpickpath(&init, "initial pick path");
  8709.   pet = readinteger("prompt and echo type ? ");
  8710.   echo = readlimit("echo area");
  8711.   /* read data record depending on dev, pet */
  8712.   readpickrec(dev, pet, &record);
  8713.   order = readphigsenum(PTKEPATHORDER, "pick path order ? ");
  8714.   pinit_pick(wsid, dev, status, &init, pet, &echo, &record, order);
  8715. }  /* do_pinit_pick */
  8716.  
  8717. /*--------------------------------------------------------------------------*/
  8718.  
  8719. static void do_pinit_pick3()
  8720. {
  8721.   Pint wsid, dev, pet;
  8722.   Pin_status status;
  8723.   Ppick_path init;
  8724.   Plimit3 echo;
  8725.   Ppick_data record;
  8726.   Ppath_order order;
  8727.  
  8728.   wsid = readinteger("workstation identifier ? ");
  8729.   dev = readinteger("pick device number ? ");
  8730.   status = readphigsenum(PTKEISTATUS, "initial pick status ? ");
  8731.   /* read initial pick path */
  8732.   readpickpath(&init, "initial pick path");
  8733.   pet = readinteger("prompt and echo type ? ");
  8734.   echo = readlimit3("echo volume");
  8735.   /* read data record depending on dev, pet */
  8736.   readpickrec3(dev, pet, &record);
  8737.   order = readphigsenum(PTKEPATHORDER, "pick path order ? ");
  8738.   pinit_pick3(wsid, dev, status, &init, pet, &echo, &record, order);
  8739. }  /* do_pinit_pick3 */
  8740.  
  8741. /*--------------------------------------------------------------------------*/
  8742.  
  8743. static void do_pinit_string()
  8744. {
  8745.   Pint wsid, dev, pet;
  8746.   char init[255];
  8747.   Plimit echo;
  8748.   Pstring_data record;
  8749.  
  8750.   wsid = readinteger("workstation identifier ? ");
  8751.   dev = readinteger("string device number ? ");
  8752.   readquote(init, "initial string ? ");
  8753.   pet = readinteger("prompt and echo type ? ");
  8754.   echo = readlimit("echo area");
  8755.   /* read data record depending on dev, pet */
  8756.   readstringrec(dev, pet, &record);
  8757.   pinit_string(wsid, dev, init, pet, &echo, &record);
  8758. }  /* do_pinit_string */
  8759.  
  8760. /*--------------------------------------------------------------------------*/
  8761.  
  8762. static void do_pinit_string3()
  8763. {
  8764.   Pint wsid, dev, pet;
  8765.   char init[255];
  8766.   Plimit3 echo;
  8767.   Pstring_data record;
  8768.  
  8769.   wsid = readinteger("workstation identifier ? ");
  8770.   dev = readinteger("string device number ? ");
  8771.   readquote(init, "initial string ? ");
  8772.   pet = readinteger("prompt and echo type ? ");
  8773.   echo = readlimit3("echo volume");
  8774.   /* read data record depending on dev, pet */
  8775.   readstringrec3(dev, pet, &record);
  8776.   pinit_string(wsid, dev, init, pet, &echo, &record);
  8777. }  /* do_pinit_string3 */
  8778.  
  8779. /*--------------------------------------------------------------------------*/
  8780.  
  8781. static void do_pinit_stroke()
  8782. {
  8783.   Pint wsid, dev, pet, i, initview;
  8784.   Ppoint_list initpts;
  8785.   Plimit echo;
  8786.   Pstroke_data record;
  8787.  
  8788.   wsid = readinteger("workstation identifier ? ");
  8789.   dev = readinteger("stroke device number ? ");
  8790.   initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
  8791.   initpts.num_points = readposinteger("initial number of points ? ");
  8792.   initpts.points = (Ppoint *)calloc(initpts.num_points, sizeof(Ppoint));
  8793.   for (i = 0; i < initpts.num_points; i++)
  8794.     initpts.points[i] = readpoint("initial points");
  8795.   pet = readinteger("prompt and echo type ? ");
  8796.   echo = readlimit("echo area");
  8797.   /* read data record depending on dev, pet */
  8798.   readstrokerec(dev, pet, &record);
  8799.   pinit_stroke(wsid, dev, initview, &initpts, pet, &echo, &record);
  8800.   free(initpts.points);
  8801. }  /* do_pinit_stroke */
  8802.  
  8803. /*--------------------------------------------------------------------------*/
  8804.  
  8805. static void do_pinit_stroke3()
  8806. {
  8807.   Pint wsid, dev, pet, i, initview;
  8808.   Ppoint_list3 initpts;
  8809.   Plimit3 echo;
  8810.   Pstroke_data3 record;
  8811.  
  8812.   wsid = readinteger("workstation identifier ? ");
  8813.   dev = readinteger("stroke device number ? ");
  8814.   initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
  8815.   initpts.num_points = readposinteger("initial number of points ? ");
  8816.   initpts.points = (Ppoint3 *)calloc(initpts.num_points, sizeof(Ppoint3));
  8817.   for (i = 0; i < initpts.num_points; i++)
  8818.     initpts.points[i] = readpoint3("initial points");
  8819.   pet = readinteger("prompt and echo type ? ");
  8820.   echo = readlimit3("echo volume");
  8821.   /* read data record depending on dev, pet */
  8822.   readstrokerec3(dev, pet, &record);
  8823.   pinit_stroke3(wsid, dev, initview, &initpts, pet, &echo, &record);
  8824.   free(initpts.points);
  8825. }  /* do_pinit_stroke3 */
  8826.  
  8827. /*--------------------------------------------------------------------------*/
  8828.  
  8829. static void do_pinit_val()
  8830. {
  8831.   Pint wsid, dev, pet;
  8832.   Pfloat init;
  8833.   Plimit echo;
  8834.   Pval_data record;
  8835.  
  8836.   wsid = readinteger("workstation identifier ? ");
  8837.   dev = readinteger("valuator device number ? ");
  8838.   init = readreal("initial value ? ");
  8839.   pet = readinteger("prompt and echo type ? ");
  8840.   echo = readlimit("echo area");
  8841.   /* read data record depending on dev, pet */
  8842.   readvalrec(dev, pet, &record);
  8843.   pinit_val(wsid, dev, init, pet, &echo, &record);
  8844. }  /* do_pinit_val */
  8845.  
  8846. /*--------------------------------------------------------------------------*/
  8847.  
  8848. static void do_pinit_val3()
  8849. {
  8850.   Pint wsid, dev, pet;
  8851.   Pfloat init;
  8852.   Plimit3 echo;
  8853.   Pval_data record;
  8854.  
  8855.   wsid = readinteger("workstation identifier ? ");
  8856.   dev = readinteger("valuator device number ? ");
  8857.   init = readreal("initial value ? ");
  8858.   pet = readinteger("prompt and echo type ? ");
  8859.   echo = readlimit3("echo volume");
  8860.   /* read data record depending on dev, pet */
  8861.   readvalrec3(dev, pet, &record);
  8862.   pinit_val3(wsid, dev, init, pet, &echo, &record);
  8863. }  /* do_pinit_val3 */
  8864.  
  8865. /*--------------------------------------------------------------------------*/
  8866.  
  8867. #include "pinqfns.c"
  8868.  
  8869. /*--------------------------------------------------------------------------*/
  8870.  
  8871. static void do_pinterpret()
  8872. {
  8873.   phintererror(1, (char *)NULL, INFORM);
  8874. }  /* do_pinterpret */
  8875.  
  8876. /*--------------------------------------------------------------------------*/
  8877.  
  8878. static void do_plabel()
  8879. {
  8880.   plabel(readintvalue("label ? ", PTKELABELVAL));
  8881. }  /* do_plabel */
  8882.  
  8883. /*--------------------------------------------------------------------------*/
  8884.  
  8885. static void do_pmessage()
  8886. {
  8887.   Pint wsid;
  8888.   char str[255];
  8889.  
  8890.   wsid = readinteger("workstation identifier ? ");
  8891.   readquote(str, "message ? ");
  8892.   pmessage(wsid, str);
  8893. }  /* do_pmessage */
  8894.  
  8895. /*--------------------------------------------------------------------------*/
  8896.  
  8897. static void do_poffsetelemptr()
  8898. {
  8899.   poffset_elem_ptr(readinteger("offset ? "));
  8900. }  /* do_poffsetelemptr */
  8901.  
  8902. /*--------------------------------------------------------------------------*/
  8903.  
  8904. static void do_popenarfile()
  8905. {
  8906.   Pint lib_id;
  8907.   char s[201];
  8908.  
  8909.   readargument(s, "archive file name ? ");
  8910.   lib_id = readinteger("archive identifier ? ");
  8911.   popen_ar_file(lib_id, s);
  8912. }  /* do_popenarfile */
  8913.  
  8914. /*--------------------------------------------------------------------------*/
  8915.  
  8916. static void do_popenphigs()
  8917. {
  8918.   char errfile[255];
  8919.   Pint size;
  8920.   char *errf;
  8921.  
  8922.   readargument(errfile, "name of error logging file ? ");
  8923.   if ((strcmp(errfile, "NULL") == 0) || (strcmp(errfile, "0") == 0))
  8924.   /* Implementation dependent - HP PHIGS doesn't like to use
  8925.   ** PDEF_ERR_FILE in open_phigs.
  8926.   */   
  8927. #ifndef HP
  8928.     /* do for SUN and PEXSI */
  8929.     errf = PDEF_ERR_FILE;
  8930. #endif
  8931. #ifdef HP
  8932.     errf = stderr;
  8933. #endif
  8934.   else
  8935. #ifndef HP
  8936.     /* do for SUN and PEXSI */
  8937.     errf = errfile;
  8938. #endif
  8939. #ifdef HP
  8940.     errf = fopen(errfile, "w+");
  8941. #endif
  8942.   size = readposinteger("number of memory units ? ");
  8943.   if (size == 0)
  8944.     size = PDEF_MEM_SIZE;
  8945.   popen_phigs(errf, (Pint)size);
  8946. }  /* do_popenphigs */
  8947.  
  8948. /*--------------------------------------------------------------------------*/
  8949.  
  8950. static void do_popenstruct()
  8951. {
  8952.   popen_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
  8953. }  /* do_popenstruct */
  8954.  
  8955. /*--------------------------------------------------------------------------*/
  8956.  
  8957. #ifdef SUN
  8958. static setwstype(C(Pint *) wst)
  8959. PreANSI(Pint *wst)
  8960. {
  8961.   Pint numwdt, i, wsint;
  8962.   ptkewstypeattr phigsattr;
  8963.   Pfloat wsreal;
  8964.  
  8965.   numwdt = readposinteger("number of WDT items ? ");
  8966.   for (i = 0; i < numwdt; i++)
  8967.   {
  8968.     phigsattr = readphigsenum(PTKEWSTYPEATTR, "workstation attribute ? ");
  8969.     switch (phigsattr)
  8970.     {
  8971.       case BASE_NAME: /* can't be set */ break;
  8972.  
  8973.       case DOUBLE_BUFFER: 
  8974.       {
  8975.         Pint buff;
  8976.  
  8977.         buff = readinteger("double buffering method ? ");
  8978.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_BUF_MODE, buff, 0);
  8979.       }
  8980.       break;
  8981.  
  8982.       case NORM_CURSOR_TYPE:
  8983.       {
  8984.         Phigs_cursor_type cursor;
  8985.   
  8986.         cursor = readphigsenum(PTKECURSORTYPE, "normal cursor type ? ");
  8987.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_NORM_CURSOR_TYPE, 
  8988.                                           cursor, 0);
  8989.       }
  8990.       break;
  8991.   
  8992.       case NORM_CURSOR_COLOUR:
  8993.       {
  8994.         Prgb color;
  8995.  
  8996.         color.red = readreal("normal cursor colour, red ? ");
  8997.         color.green = readreal("normal cursor colour, green ? ");
  8998.         color.blue = readreal("normal cursor colour, blue ? ");
  8999.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_NORM_CURSOR_COLOUR, 
  9000.                                        &color, 0);
  9001.       }
  9002.       break;
  9003.     
  9004.       case TRAV_CURSOR_TYPE:
  9005.       {
  9006.         Phigs_cursor_type cursor;
  9007.   
  9008.         cursor = readphigsenum(PTKECURSORTYPE, "traversal cursor type ? ");
  9009.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TRAV_CURSOR_TYPE, 
  9010.                                           cursor, 0);
  9011.       }
  9012.       break;
  9013.   
  9014.       case TRAV_CURSOR_COLOUR:
  9015.       {
  9016.         Prgb color;
  9017.  
  9018.         color.red = readreal("traversal cursor colour, red ? ");
  9019.         color.green = readreal("traversal cursor colour, green ? ");
  9020.         color.blue = readreal("traversal cursor colour, blue ? ");
  9021.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TRAV_CURSOR_COLOUR, 
  9022.                                        &color, 0);
  9023.       }
  9024.       break;
  9025.     
  9026.       case ACCELERATOR_USAGE:
  9027.       {
  9028.         Phigs_acc_usage accusage;
  9029.  
  9030.         accusage = readphigsenum(PTKEACCUSAGE, "accelerator usage ? ");
  9031.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_ACCELERATOR_USAGE, 
  9032.                                           accusage, 0);
  9033.       }
  9034.       break;
  9035.   
  9036.       case COLOUR_MODE:
  9037.       {
  9038.         Phigs_colr_mode cmode;
  9039.   
  9040.         cmode = readphigsenum(PTKECOLOURMODE, "colour mode ? ");
  9041.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_COLOUR_MODE, cmode, 0);
  9042.       }
  9043.       break;
  9044.   
  9045.       case TOOL_WIDTH:
  9046.         wsint = readposinteger("tool window width ? ");
  9047.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_WIDTH, wsint, 0);
  9048.         break;
  9049.   
  9050.       case TOOL_HEIGHT:
  9051.         wsint = readposinteger("tool window height ? ");
  9052.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_HEIGHT, wsint, 0);
  9053.         break;
  9054.   
  9055.       case TOOL_X:
  9056.         wsint = readposinteger("tool window position, x ? ");
  9057.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_X, wsint, 0);
  9058.         break;
  9059.   
  9060.       case TOOL_Y:
  9061.         wsint = readposinteger("tool window position, y ? ");
  9062.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_Y, wsint, 0);
  9063.         break;
  9064.   
  9065.       case TOOL_LABEL:
  9066.       {
  9067.         char label[255];
  9068.  
  9069.         readquote(label, "frame banner ? ");
  9070.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_LABEL, label, 0);
  9071.       }  
  9072.       break;
  9073.  
  9074.       case TOOL_ICON_FILE:
  9075.       {
  9076.         char path[255];
  9077.  
  9078.         readquote(path, "icon definition file ? ");
  9079.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_FILE, 
  9080.                                           path, 0);
  9081.       }
  9082.       break;
  9083.       
  9084.       case TOOL_ICON_LABEL:
  9085.       {
  9086.         char label[255];
  9087.  
  9088.         readquote(label, "icon label ? ");
  9089.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_LABEL, 
  9090.                                           label, 0);
  9091.       }
  9092.       break;
  9093.  
  9094.       case TOOL_BORDER_WIDTH:
  9095.         wsint = readposinteger("tool window border width ? ");
  9096.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_BORDER_WIDTH, 
  9097.                                        wsint, 0);
  9098.         break;
  9099.       
  9100.       case WS_CATEGORY:
  9101.       {
  9102.         Pws_cat wscat;
  9103.   
  9104.         wscat = readphigsenum(PTKEWSCAT, "workstation category ? ");
  9105.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WS_CATEGORY, wscat, 0);
  9106.       }
  9107.       break;
  9108.   
  9109.       case COLOUR_TABLE_SIZE: 
  9110.         wsint = readposinteger("colour table size ? ");
  9111.         if (wsint > 256) 
  9112.           wsint = 256;
  9113.         /* SunPHIGS: max on indexed color ws = 256
  9114.         ** max on true color ws = 4096
  9115.         */
  9116.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_COLOUR_TABLE_SIZE, 
  9117.                                           wsint, 0);
  9118.         break;
  9119.  
  9120.       case WST_NUM_VIEW_REP: 
  9121.         wsint = readposinteger("view table size ? ");
  9122.         if (wsint < 6) 
  9123.           wsint = 6;
  9124.         /* SunPHIGS: min = 6 */
  9125.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WST_NUM_VIEW_REP, 
  9126.                                        wsint, 0);
  9127.         break;
  9128.  
  9129.       case X_CMAP_PROP_ATOM: 
  9130.         wsint = readinteger("property atom ? ");
  9131.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_CMAP_PROP_ATOM, 
  9132.                                        wsint, 0);
  9133.         break;
  9134.  
  9135.       case DC_MODEL: 
  9136.       {
  9137.         Phigs_DC_model model;
  9138.  
  9139.         model = readphigsenum(PTKEDCMODEL, "DC model ? ");
  9140.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_DC_MODEL, 
  9141.                                        model, 0);
  9142.       }
  9143.       break;
  9144.  
  9145.       case SIMULATE_PICK: 
  9146.       {
  9147.         Phigs_simulate_pick pick;
  9148.  
  9149.         pick = readphigsenum(PTKESIMULATEPICK, "pick simulation ? ");
  9150.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_SIMULATE_PICK, 
  9151.                                        pick, 0);
  9152.       }
  9153.       break;
  9154.  
  9155.       case STEREO: 
  9156.         wsint = readinteger("stereo ? ");
  9157.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_STEREO, wsint, 0);
  9158.       break;
  9159.  
  9160.       case X_DISPLAY_NAME:
  9161.       {
  9162.         char name[80];
  9163.   
  9164.         readquote(name, "display name ? ");
  9165.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_DISPLAY_NAME, 
  9166.                                        name, 0);
  9167.       }
  9168.       break;
  9169.     
  9170.       case CGM_ENCODING:
  9171.       {
  9172.         Phigs_cgm_encoding encode;
  9173.   
  9174.         encode = readphigsenum(PTKECGMENCODING, "CGM encoding ? ");
  9175.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_ENCODING, 
  9176.                                           encode, 0);
  9177.       }
  9178.       break;
  9179.   
  9180.       case CGM_CONFORMANCE:
  9181.       {
  9182.         Phigs_cgm_conformance conform;
  9183.   
  9184.         conform = readphigsenum(PTKECGMCONFORMANCE, "CGM conformance ? ");
  9185.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_CONFORMANCE, 
  9186.                                           conform, 0);
  9187.       }
  9188.       break;
  9189.   
  9190.       case CGM_METRIC_HEIGHT_PTR: 
  9191.         wsreal = readreal("CGM drawing height ? ");
  9192.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_METRIC_HEIGHT_PTR, 
  9193.                                           &wsreal, 0);
  9194.         break;
  9195.   
  9196.       case CGM_METRIC_WIDTH_PTR: 
  9197.         wsreal = readreal("CGM drawing width ? ");
  9198.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_METRIC_WIDTH_PTR, 
  9199.                                           &wsreal, 0);
  9200.         break;
  9201.   
  9202.       case CGM_METRIC_LINE_WIDTH_PTR: 
  9203.         wsreal = readreal("CGM line width ? ");
  9204.         *wst = (Pint)phigs_ws_type_set(*wst, 
  9205.                         PHIGS_CGM_METRIC_LINE_WIDTH_PTR, &wsreal, 0);
  9206.         break;
  9207.  
  9208.       case CGM_VDC_PRECISION:
  9209.       {
  9210.         Phigs_cgm_vdc_precision prec;
  9211.   
  9212.         prec = readphigsenum(PTKECGMVDCPRECISION, "CGM precision ? ");
  9213.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_VDC_PRECISION, 
  9214.                                           prec, 0);
  9215.       }
  9216.       break;
  9217.   
  9218.       case REGION_RECT: 
  9219.       {
  9220.         Prect region;
  9221.  
  9222.         region.p.x = readreal("lower left, x ? ");
  9223.         region.p.y = readreal("lower left, y ? ");
  9224.         region.q.x = readreal("upper right, x ? ");
  9225.         region.q.y = readreal("upper right, y ? ");
  9226.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_RECT, 
  9227.                                           ®ion, 0);
  9228.       }
  9229.       break;
  9230.   
  9231.       case REGION_PRIORITY: 
  9232.         wsreal = readreal("region priority ? ");
  9233.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_PRIORITY, 
  9234.                                           &wsreal, 0);
  9235.         break;
  9236.   
  9237.       case REGION_BACKGROUND: 
  9238.       {
  9239.         Phigs_bg_clear region;
  9240.   
  9241.         region = readphigsenum(PTKEBGCLEAR, "background clear ? ");
  9242.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_BACKGROUND, 
  9243.                                           region, 0);
  9244.       }
  9245.       break;
  9246.  
  9247.       case USE_DECOMP:
  9248.       {
  9249.         Phigs_dcmp dcmp;
  9250.  
  9251.         dcmp = readphigsenum(PTKEUSEDECOMP, "use decomposition ? ");
  9252.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_USE_DECOMP, 
  9253.                                           dcmp, 0);  
  9254.       }
  9255.       break;
  9256.  
  9257.       default: phintererror(2, "No such attribute.\n", INFORM);
  9258.     
  9259.     }
  9260.   }
  9261. }
  9262. #endif
  9263.  
  9264. /*--------------------------------------------------------------------------*/
  9265.  
  9266. #ifdef PEXSI
  9267. static setwstype(C(Pint *) wst)
  9268. PreANSI(Pint *wst)
  9269. {
  9270.   Pint numwdt, i, wsint;
  9271.   ptkewstypeattr phigsattr;
  9272.   Pfloat wsreal;
  9273.  
  9274.   numwdt = readinteger("number of WDT items ? ");
  9275.   for (i = 0; i < numwdt; i++)
  9276.   {
  9277.     phigsattr = readphigsenum(PTKEWSTYPEATTR, "workstation attribute ? ");
  9278.     switch (phigsattr)
  9279.     {
  9280.       case BASE_NAME: /* can't be set */ break;
  9281.  
  9282.       case DOUBLE_BUFFER: 
  9283.       {
  9284.         Pint buff;
  9285.  
  9286.         buff = readinteger("double buffering method ? ");
  9287.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_BUF_MODE, buff, NULL);
  9288.       }
  9289.       break;
  9290.   
  9291.       case TOOL_WIDTH:
  9292.         wsint = readposinteger("tool window width ? ");
  9293.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_WIDTH, wsint, NULL);
  9294.         break;
  9295.   
  9296.       case TOOL_HEIGHT:
  9297.         wsint = readposinteger("tool window height ? ");
  9298.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_HEIGHT, wsint, NULL);
  9299.         break;
  9300.   
  9301.       case TOOL_X:
  9302.         wsint = readposinteger("tool window position, x ? ");
  9303.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_X, wsint, NULL);
  9304.         break;
  9305.   
  9306.       case TOOL_Y:
  9307.         wsint = readposinteger("tool window position, y ? ");
  9308.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_Y, wsint, NULL);
  9309.         break;
  9310.   
  9311.       case TOOL_LABEL:
  9312.       {
  9313.         char label[255];
  9314.  
  9315.         readquote(label, "frame banner ? ");
  9316.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_LABEL, label, NULL);
  9317.       }  
  9318.       break;
  9319.       
  9320.       case TOOL_ICON_LABEL:
  9321.       {
  9322.         char label[255];
  9323.  
  9324.         readquote(label, "icon label ? ");
  9325.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_LABEL, 
  9326.                                           label, NULL);
  9327.       }
  9328.       break;
  9329.  
  9330.       case TOOL_BORDER_WIDTH:
  9331.         wsint = readposinteger("tool window border width ? ");
  9332.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_BORDER_WIDTH, 
  9333.                                        wsint, NULL);
  9334.         break;
  9335.       
  9336.       case WS_CATEGORY:
  9337.       {
  9338.         Pws_cat wscat;
  9339.   
  9340.         wscat = readphigsenum(PTKEWSCAT, "workstation category ? ");
  9341.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WS_CATEGORY, wscat, NULL);
  9342.       }
  9343.       break;
  9344.  
  9345.       case X_CMAP_PROP_ATOM: 
  9346.         wsint = readinteger("property atom ? ");
  9347.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_CMAP_PROP_ATOM, 
  9348.                                        wsint, NULL);
  9349.         break;
  9350.  
  9351.       case DC_MODEL: 
  9352.       {
  9353.         Phigs_DC_model model;
  9354.  
  9355.         model = readphigsenum(PTKEDCMODEL, "DC model ? ");
  9356.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_DC_MODEL, 
  9357.                                        model, NULL);
  9358.       }
  9359.       break;
  9360.  
  9361.       case X_DISPLAY_NAME:
  9362.       {
  9363.         char name[80];
  9364.   
  9365.         readquote(name, "display name ? ");
  9366.         *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_DISPLAY_NAME, 
  9367.                                        name, NULL);
  9368.       }
  9369.       break;    
  9370.  
  9371.       default: phintererror(2, "No such attribute.\n", INFORM);
  9372.     }
  9373.   }
  9374. }
  9375. #endif
  9376.  
  9377. /*--------------------------------------------------------------------------*/
  9378.  
  9379. static void do_popenws()
  9380. {
  9381.   Pint wsid;
  9382.   char conn[255];
  9383.   Pint wst;
  9384. #ifdef HP
  9385.   Pint connid;
  9386. #endif
  9387.  
  9388.   wsid = readinteger("workstation identifier ? ");
  9389.   readargument(conn, "connection identifier ? ");
  9390.   readwstype(&wst);
  9391. #ifdef SUN
  9392.   setwstype(&wst);
  9393. #endif
  9394. #ifdef PEXSI
  9395.   setwstype(&wst);
  9396. #endif
  9397. #ifdef VMS
  9398.   if (strncmp(conn, "0", 1) == 0)
  9399.     popen_ws(wsid, (Pconnid)0, wst);
  9400.   else
  9401. #endif
  9402. #ifdef HP
  9403.   pue004(conn, &connid, strlen(conn));
  9404.   popen_ws(wsid, connid, wst);
  9405. #endif
  9406. #ifndef HP
  9407.   popen_ws(wsid, (void *)conn, wst);
  9408. #endif
  9409. }  /* do_popenws */
  9410.  
  9411. /*--------------------------------------------------------------------------*/
  9412.  
  9413. static void do_ppolyline()
  9414. {
  9415.   Ppoint_list pts;
  9416.  
  9417.   pts.num_points = readposinteger("number of points ? ");
  9418.   pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
  9419.   readpointarray(pts.num_points, pts.points);
  9420.   ppolyline(&pts);
  9421.   free(pts.points);
  9422. }  /* do_ppolyline */
  9423.  
  9424. /*--------------------------------------------------------------------------*/
  9425.  
  9426. static void do_ppolyline3()
  9427. {
  9428.   Ppoint_list3 pts;
  9429.  
  9430.   pts.num_points = readposinteger("number of points ? ");
  9431.   pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
  9432.   readpoint3array(pts.num_points, pts.points);
  9433.   ppolyline3(&pts);
  9434.   free(pts.points);
  9435. }  /* do_ppolyline3 */
  9436.  
  9437. /*--------------------------------------------------------------------------*/
  9438.  
  9439. static void do_ppolymarker()
  9440. {
  9441.   Ppoint_list pts;
  9442.  
  9443.   pts.num_points = readposinteger("number of points ? ");
  9444.   pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
  9445.   readpointarray(pts.num_points, pts.points);
  9446.   ppolymarker(&pts);
  9447.   free(pts.points);
  9448. }  /* do_ppolymarker */
  9449.  
  9450. /*--------------------------------------------------------------------------*/
  9451.  
  9452. static void do_ppolymarker3()
  9453. {
  9454.   Ppoint_list3 pts;
  9455.  
  9456.   pts.num_points = readposinteger("number of points ? ");
  9457.   pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
  9458.   readpoint3array(pts.num_points, pts.points);
  9459.   ppolymarker3(&pts);
  9460.   free(pts.points);
  9461. }  /* do_ppolymarker3 */
  9462.  
  9463. /*--------------------------------------------------------------------------*/
  9464.  
  9465. static void do_ppoststruct()
  9466. {
  9467.   Pint ws_no, s_name;
  9468.   Pfloat pri;
  9469.  
  9470.   ws_no = readinteger("workstation identifier ? ");
  9471.   s_name = readintvalue("structure identifier ? ", PTKESTRUCTID);
  9472.   pri = readreal("priority ? ");
  9473.   ppost_struct(ws_no, s_name, pri);
  9474. }  /* do_ppoststruct */
  9475.  
  9476. /*--------------------------------------------------------------------------*/
  9477.  
  9478. static void do_preadmf()
  9479. {
  9480.   phintererror(1, (char *)NULL, INFORM);
  9481. }  /* do_preadmf */
  9482.  
  9483. /*--------------------------------------------------------------------------*/
  9484.  
  9485. static void do_predrawallstruct()
  9486. {
  9487.   Pint wsid;
  9488.   Pctrl_flag controlflag;
  9489.  
  9490.   wsid = readinteger("workstation identifier ? ");
  9491.   controlflag = readphigsenum(PTKECONTROL, "control flag ? ");
  9492.   predraw_all_structs(wsid, controlflag);
  9493. }  /* do_predrawallstruct */
  9494.  
  9495. /*--------------------------------------------------------------------------*/
  9496.  
  9497. static void do_premovenameset()
  9498. {
  9499.   Pint_list remset;
  9500.  
  9501.   readintlst(&remset, "name set", PTKENAME);
  9502.   premove_names_set(&remset);
  9503.   free(remset.ints); 
  9504. }  /* do_premovenameset */
  9505.  
  9506. /*--------------------------------------------------------------------------*/
  9507.  
  9508. static void do_preqchoice()
  9509. {
  9510.   Pint wsid, dev, choice;
  9511.   Pin_status status;
  9512.  
  9513.   wsid = readinteger("workstation identifier ? ");
  9514.   dev = readinteger("choice device number ? ");
  9515.   preq_choice(wsid, dev, &status, &choice);
  9516.   if (writeinform)
  9517.   {
  9518.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9519.     phinprintf(PTKEINFORM, "status of request = ");
  9520.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9521.     if (status == PIN_STATUS_OK)
  9522.     {
  9523.       phinprintf(PTKEINFORM, "choice = ");
  9524.       writeinteger(PTKEINFORM, choice);
  9525.     }
  9526.   }
  9527. }  /* do_preqchoice */
  9528.  
  9529. /*--------------------------------------------------------------------------*/
  9530.  
  9531. static void do_preqloc()
  9532. {
  9533.   Pint wsid, dev, view_index;
  9534.   Pin_status status;
  9535.   Ppoint pos;
  9536.  
  9537.   wsid = readinteger("workstation identifier ? ");
  9538.   dev = readinteger("locator device number ? ");
  9539.   preq_loc(wsid, dev, &status, &view_index, &pos);
  9540.   if (writeinform)
  9541.   {
  9542.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9543.     phinprintf(PTKEINFORM, "status of request = ");
  9544.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9545.     if (status == PIN_STATUS_OK)
  9546.     {
  9547.       phinprintf(PTKEINFORM, "view index = ");
  9548.       writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  9549.       phinprintf(PTKEINFORM, "point:\n");
  9550.       writepoint(PTKEINFORM, &pos);
  9551.     }
  9552.   }
  9553. }  /* do_preqloc */
  9554.  
  9555. /*--------------------------------------------------------------------------*/
  9556.  
  9557. static void do_preqloc3()
  9558. {
  9559.   Pint wsid, dev, view_index;
  9560.   Pin_status status;
  9561.   Ppoint3 pos;
  9562.  
  9563.   wsid = readinteger("workstation identifier ? ");
  9564.   dev = readinteger("locator device number ? ");
  9565.   preq_loc3(wsid, dev, &status, &view_index, &pos);
  9566.   if (writeinform)
  9567.   {
  9568.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9569.     phinprintf(PTKEINFORM, "status of request = ");
  9570.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9571.     if (status == PIN_STATUS_OK)
  9572.     {
  9573.       phinprintf(PTKEINFORM, "view index = ");
  9574.       writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  9575.       phinprintf(PTKEINFORM, "point:\n");
  9576.       writepoint3(PTKEINFORM, &pos);
  9577.     }
  9578.   }
  9579. }  /* do_preqloc3 */
  9580.  
  9581. /*--------------------------------------------------------------------------*/
  9582.  
  9583. static void do_preqpick()
  9584. {
  9585.   Pint wsid, dev, depth;
  9586.   Pin_status status;
  9587.   Ppick_path pick;
  9588.  
  9589.   wsid = readinteger("workstation identifier ? ");
  9590.   dev = readinteger("pick device number ? ");
  9591.   depth = readposinteger("pick path depth ? ");
  9592.   pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
  9593.   preq_pick(wsid, dev, depth, &status, &pick);
  9594.   if (writeinform)
  9595.   {
  9596.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9597.     phinprintf(PTKEINFORM, "status of request = ");
  9598.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9599.     if (status == PIN_STATUS_OK)
  9600.     {
  9601.       phinprintf(PTKEINFORM, "pick path:\n");
  9602.       writepickpath(PTKEINFORM, &pick); 
  9603.     }
  9604.   }
  9605.   free(pick.path_list);
  9606. }  /* do_preqpick */
  9607.  
  9608. /*--------------------------------------------------------------------------*/
  9609.  
  9610. static void do_preqstring()
  9611. {
  9612.   Pint wsid, dev, size;
  9613.   Pin_status status;
  9614.   char string[255];
  9615.  
  9616.   wsid = readinteger("workstation identifier ? ");
  9617.   dev = readinteger("string device number ? ");
  9618.   preq_string(wsid, dev, &status, string);
  9619.   if (writeinform)
  9620.   {
  9621.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9622.     phinprintf(PTKEINFORM, "status of request = ");
  9623.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9624.     if (status == PIN_STATUS_OK)
  9625.       phinprintf(PTKEINFORM, "string = \"%s\"\n", string); 
  9626.   }
  9627. }  /* do_preqstring */
  9628.  
  9629. /*--------------------------------------------------------------------------*/
  9630.  
  9631. static void do_preqstroke()
  9632. {
  9633.   Pint wsid, dev, size, view_index;
  9634.   Pin_status status;
  9635.   Ppoint_list stroke;
  9636.   Ppoint pts[255];
  9637.  
  9638.   wsid = readinteger("workstation identifier ? ");
  9639.   dev = readinteger("stroke device number ? ");
  9640.   stroke.points = pts;
  9641.   preq_stroke(wsid, dev, &status, &view_index, &stroke);
  9642.   if (writeinform)
  9643.   {
  9644.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9645.     phinprintf(PTKEINFORM, "status of request = ");
  9646.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9647.     if (status == PIN_STATUS_OK)
  9648.     {
  9649.       phinprintf(PTKEINFORM, "view index = ");
  9650.       writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  9651.       phinprintf(PTKEINFORM, "number of points = ");
  9652.       writeinteger(PTKEINFORM, stroke.num_points);
  9653.       phinprintf(PTKEINFORM, "points:\n");
  9654.       writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
  9655.     }
  9656.   }
  9657. }  /* do_preqstroke */
  9658.  
  9659. /*--------------------------------------------------------------------------*/
  9660.  
  9661. static void do_preqstroke3()
  9662. {
  9663.   Pint wsid, dev, size, view_index;
  9664.   Pin_status status;
  9665.   Ppoint_list3 stroke;
  9666.   Ppoint3 pts[255];
  9667.  
  9668.   wsid = readinteger("workstation identifier ? ");
  9669.   dev = readinteger("stroke device number ? ");
  9670.   stroke.points = pts;
  9671.   preq_stroke3(wsid, dev, &status, &view_index, &stroke);
  9672.   if (writeinform)
  9673.   {
  9674.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9675.     phinprintf(PTKEINFORM, "status of request = ");
  9676.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9677.     if (status == PIN_STATUS_OK)
  9678.     {
  9679.       phinprintf(PTKEINFORM, "view index = ");
  9680.       writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  9681.       phinprintf(PTKEINFORM, "number of points = ");
  9682.       writeinteger(PTKEINFORM, stroke.num_points);
  9683.       phinprintf(PTKEINFORM, "points:\n");
  9684.       writepointarray3(PTKEINFORM, stroke.num_points, stroke.points);
  9685.     }
  9686.   }
  9687. }  /* do_preqstroke3 */
  9688.  
  9689. /*--------------------------------------------------------------------------*/
  9690.  
  9691. static void do_preqval()
  9692. {
  9693.   Pint wsid, dev;
  9694.   Pin_status status;
  9695.   Pfloat val;
  9696.  
  9697.   wsid = readinteger("workstation identifier ? ");
  9698.   dev = readinteger("valuator device number ? ");
  9699.   preq_val(wsid, dev, &status, &val);
  9700.   if (writeinform)
  9701.   {
  9702.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9703.     phinprintf(PTKEINFORM, "status of request = ");
  9704.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9705.     if (status == PIN_STATUS_OK)
  9706.     {
  9707.       phinprintf(PTKEINFORM, "value = ");
  9708.       writereal(PTKEINFORM, val);
  9709.     }
  9710.   }
  9711. }  /* do_preqval */
  9712.  
  9713. /*--------------------------------------------------------------------------*/
  9714.  
  9715. static void do_prestoremodelclipvolume()
  9716. {
  9717.   prestore_model_clip_vol();
  9718. }  /* do_prestoremodelclipvolume */
  9719.  
  9720. /*--------------------------------------------------------------------------*/
  9721.  
  9722. static void do_pretrieveallstruct()
  9723. {
  9724.   pret_all_structs(readinteger("archive identifier ? "));
  9725. }  /* do_pretrieveallstruct */
  9726.  
  9727. /*--------------------------------------------------------------------------*/
  9728.  
  9729. static void do_pretrieveancesstruct()
  9730. {
  9731.   Pint arid, stid, depth, err, status, i, j;
  9732.   Ppath_order order;
  9733.   Pelem_ref_list_list *paths;
  9734.   Pstore store;
  9735.  
  9736. #ifdef HP
  9737.   phintererror(1, (char *)NULL, INFORM);
  9738. #else
  9739.   arid = readinteger("archive identifier ? ");
  9740.   stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
  9741.   order = readphigsenum(PTKEPATHORDER, "path order ? ");
  9742.   depth = readposinteger("path depth ? ");
  9743.   pcreate_store(&err, &store);
  9744.   pret_paths_ances(arid, stid, order, depth, store, &paths, &status);
  9745.   if (writeinform)
  9746.   {
  9747.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9748.     if (status == 0)
  9749.     {
  9750.       phinprintf(PTKEINFORM, "ancestor paths of structure %d are:\n", stid);
  9751.       for (i = 0; i < paths->num_elem_ref_lists; i++)
  9752.       {
  9753.         phinprintf(PTKEINFORM, "path %d:\n", i);
  9754.         for (j = 0; j < paths->elem_ref_lists[i].num_elem_refs; j++)
  9755.         {
  9756.           phinprintf(PTKEINFORM, "structure identifier = ");
  9757.           writeintvalue(PTKEINFORM,
  9758.                         paths->elem_ref_lists[i].elem_refs[j].struct_id,
  9759.                         PTKESTRUCTID);
  9760.           phinprintf(PTKEINFORM, "element number = ");
  9761.           writeinteger(PTKEINFORM, 
  9762.                        paths->elem_ref_lists[i].elem_refs[j].elem_pos);
  9763.         }
  9764.       }
  9765.     }
  9766.     else
  9767.       phigserror(PTKEINFORM, err);
  9768.   }
  9769.   ptk_delstore(store);
  9770. #endif
  9771. }  /* do_pretrieveancesstruct */
  9772.  
  9773. /*--------------------------------------------------------------------------*/
  9774.  
  9775. static void do_pretrievedescstruct()
  9776. {
  9777.   Pint arid, stid, depth, err, status, i, j;
  9778.   Ppath_order order;
  9779.   Pelem_ref_list_list *paths;
  9780.   Pstore store;
  9781.  
  9782. #ifdef HP
  9783.   phintererror(1, (char *)NULL, INFORM);
  9784. #else
  9785.   arid = readinteger("archive identifier ? ");
  9786.   stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
  9787.   order = readphigsenum(PTKEPATHORDER, "path order ? ");
  9788.   depth = readposinteger("path depth ? ");
  9789.   pcreate_store(&err, &store);
  9790.   pret_paths_descs(arid, stid, order, depth, store, &paths, &status);
  9791.   if (writeinform)
  9792.   {
  9793.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9794.     if (status == 0)
  9795.     {
  9796.       phinprintf(PTKEINFORM, "descendant paths of structure %d are:\n", stid);
  9797.       for (i = 0; i < paths->num_elem_ref_lists; i++)
  9798.       {
  9799.         phinprintf(PTKEINFORM, "path %d:\n", i);
  9800.         for (j = 0; j < paths->elem_ref_lists[i].num_elem_refs; j++)
  9801.         {
  9802.           phinprintf(PTKEINFORM, "structure identifier = ");
  9803.           writeintvalue(PTKEINFORM, 
  9804.                         paths->elem_ref_lists[i].elem_refs[j].struct_id,
  9805.                         PTKESTRUCTID);
  9806.           phinprintf(PTKEINFORM, "element number = ");
  9807.           phinprintf(PTKEINFORM, 
  9808.                   paths->elem_ref_lists[i].elem_refs[j].elem_pos, "element");
  9809.         }
  9810.       }
  9811.     }
  9812.     else
  9813.       phigserror(PTKEINFORM, err);
  9814.   }
  9815.   ptk_delstore(store);
  9816. #endif
  9817. }  /* do_pretrievedescstruct */
  9818.  
  9819. /*--------------------------------------------------------------------------*/
  9820.  
  9821. static void do_pretrievestructids()
  9822. {
  9823.   Pint arid, start, totlength;
  9824.   Pint_list ids;
  9825.  
  9826.   arid = readinteger("archive identifier ? ");
  9827.   start = readposinteger("starting position ? ");
  9828.   pret_struct_ids(arid, 0, start, &ids, &totlength);
  9829.   ids.ints = (Pint *)calloc(totlength, sizeof(Pint));
  9830.   ids.num_ints = totlength;
  9831.   pret_struct_ids(arid, totlength, start, &ids, &totlength);
  9832.   if (writeinform)
  9833.   {
  9834.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9835.     phinprintf(PTKEINFORM, "structure identifiers:\n");
  9836.     writeintlst(PTKEINFORM, &ids, PTKESTRUCTID);
  9837.   }
  9838.   free(ids.ints);
  9839. }  /* do_pretrievestructids */
  9840.  
  9841. /*--------------------------------------------------------------------------*/
  9842.  
  9843. static void do_pretrievestruct()
  9844. {
  9845.   Pint i, libid;
  9846.   Pint_list sns;
  9847.   char prom[30];
  9848.  
  9849. #ifdef HP
  9850.   phintererror(1, (char *)NULL, INFORM);
  9851. #else
  9852.   libid = readinteger("archive identifier? ");
  9853.   sns.num_ints = readposinteger("number of structures to retrieve? ");
  9854.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
  9855.   for (i = 0; i < sns.num_ints; i++) 
  9856.   {
  9857.     sprintf(prom, "structure identifier [%d] ? ", i);
  9858.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  9859.   }
  9860.   pret_structs(libid, &sns);
  9861.   free(sns.ints);
  9862. #endif
  9863. }  /* do_pretrievestruct */
  9864.  
  9865. /*--------------------------------------------------------------------------*/
  9866.  
  9867. static void do_pretrievestructnet()
  9868. {
  9869.   Pint i, libid;
  9870.   Pint_list sns;
  9871.   char prom[30];
  9872.  
  9873. #ifdef HP
  9874.   phintererror(1, (char *)NULL, INFORM);
  9875. #else
  9876.   libid = readinteger("archive identifier ? ");
  9877.   sns.num_ints = readposinteger("number of structure networks to retrieve? ");
  9878.   sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));  
  9879.   for (i = 0; i < sns.num_ints; i++) 
  9880.   {
  9881.     sprintf(prom, "root structure identifier [%d] ? ", i);
  9882.     sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
  9883.   }
  9884.   pret_struct_nets(libid, &sns);
  9885. #endif
  9886. }  /* do_pretrievestructnet */
  9887.  
  9888. /*--------------------------------------------------------------------------*/
  9889.  
  9890. static void do_protate()
  9891. {
  9892.   Pfloat angle;
  9893.   Pint err;
  9894.  
  9895.   angle = readreal("angle ? ");
  9896.   protate(angle, &err, tm);
  9897.   if (writeinform)
  9898.   {
  9899.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9900.     if (err == 0)
  9901.     {
  9902.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  9903.       writematrix(PTKEINFORM, tm);
  9904.     }
  9905.     else
  9906.       phigserror(PTKEINFORM, err);
  9907.   }
  9908. }  /* do_protate */
  9909.  
  9910. /*--------------------------------------------------------------------------*/
  9911.  
  9912. static void do_protatex()
  9913. {
  9914.   Pfloat angle;
  9915.   Pint err;
  9916.  
  9917.   angle = readreal("angle ? ");
  9918.   protate_x(angle, &err, tm3);
  9919.   if (writeinform)
  9920.   {
  9921.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9922.     if (err == 0)
  9923.     {
  9924.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  9925.       writematrix3(PTKEINFORM, tm3);
  9926.     }
  9927.     else
  9928.       phigserror(PTKEINFORM, err);
  9929.   }
  9930. }  /* do_protatex */
  9931.  
  9932. /*--------------------------------------------------------------------------*/
  9933.  
  9934. static void do_protatey()
  9935. {
  9936.   Pfloat angle;
  9937.   Pint err;
  9938.  
  9939.   angle = readreal("angle ? ");
  9940.   protate_y(angle, &err, tm3);
  9941.   if (writeinform)
  9942.   {
  9943.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9944.     if (err == 0)
  9945.     {
  9946.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  9947.       writematrix3(PTKEINFORM, tm3);
  9948.     }
  9949.     else
  9950.       phigserror(PTKEINFORM, err);
  9951.   }
  9952. }  /* do_protatey */
  9953.  
  9954. /*--------------------------------------------------------------------------*/
  9955.  
  9956. static void do_protatez()
  9957. {
  9958.   Pfloat angle;
  9959.   Pint err;
  9960.  
  9961.   angle = readreal("angle ? ");
  9962.   protate_z(angle, &err, tm3);
  9963.   if (writeinform)
  9964.   {
  9965.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9966.     if (err == 0)
  9967.     {
  9968.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  9969.       writematrix3(PTKEINFORM, tm3);
  9970.     }
  9971.     else
  9972.       phigserror(PTKEINFORM, err);
  9973.   }
  9974. }  /* do_protatez */
  9975.  
  9976. /*--------------------------------------------------------------------------*/
  9977.  
  9978. static void do_psamplechoice()
  9979. {
  9980.   Pint wsid, dev, choice;
  9981.   Pin_status status;
  9982.  
  9983.   wsid = readinteger("workstation identifier ? ");
  9984.   dev = readinteger("choice device number ? ");
  9985.   psample_choice(wsid, dev, &status, &choice);
  9986.   if (writeinform)
  9987.   {
  9988.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  9989.     phinprintf(PTKEINFORM, "status of request = ");
  9990.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  9991.     if (status == PIN_STATUS_OK)
  9992.     {
  9993.       phinprintf(PTKEINFORM, "choice = ");
  9994.       writeinteger(PTKEINFORM, choice);
  9995.     }
  9996.   }  
  9997. }  /* do_psamplechoice */
  9998.  
  9999. /*--------------------------------------------------------------------------*/
  10000.  
  10001. static void do_psampleloc()
  10002. {
  10003.   Pint wsid, dev, view_index;
  10004.   Ppoint pos;
  10005.  
  10006.   wsid = readinteger("workstation identifier ? ");
  10007.   dev = readinteger("locator device number ? ");
  10008.   psample_loc(wsid, dev, &view_index, &pos);
  10009.   if (writeinform)
  10010.   {
  10011.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10012.     phinprintf(PTKEINFORM, "view index = ");
  10013.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  10014.     phinprintf(PTKEINFORM, "point:\n");
  10015.     writepoint(PTKEINFORM, &pos);
  10016.   }
  10017. }  /* do_psampleloc */
  10018.  
  10019. /*--------------------------------------------------------------------------*/
  10020.  
  10021. static void do_psampleloc3()
  10022. {
  10023.   Pint wsid, dev, view_index;
  10024.   Ppoint3 pos;
  10025.  
  10026.   wsid = readinteger("workstation identifier ? ");
  10027.   dev = readinteger("locator device number ? ");
  10028.   psample_loc3(wsid, dev, &view_index, &pos);
  10029.   if (writeinform)
  10030.   {
  10031.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10032.     phinprintf(PTKEINFORM, "view index = ");
  10033.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  10034.     phinprintf(PTKEINFORM, "point:\n");
  10035.     writepoint3(PTKEINFORM, &pos);
  10036.   }
  10037. }  /* do_psampleloc3 */
  10038.  
  10039. /*--------------------------------------------------------------------------*/
  10040.  
  10041. static void do_psamplepick()
  10042. {
  10043.   Pint wsid, dev, depth;
  10044.   Pin_status status;
  10045.   Ppick_path pick;
  10046.  
  10047.   wsid = readinteger("workstation identifier ? ");
  10048.   dev = readinteger("pick device number ? ");
  10049.   depth = readposinteger("pick path depth ? ");
  10050.   pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
  10051.   pick.depth = depth;
  10052.   psample_pick(wsid, dev, depth, &status, &pick);
  10053.   if (writeinform)
  10054.   {
  10055.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10056.     phinprintf(PTKEINFORM, "status of request = ");
  10057.     writephigsenum(PTKEINFORM, PTKEISTATUS, status);
  10058.     if (status == PIN_STATUS_OK)
  10059.     {
  10060.       phinprintf(PTKEINFORM, "pick path:\n");
  10061.       writepickpath(PTKEINFORM, &pick.path_list); 
  10062.     }
  10063.   }
  10064.   free(pick.path_list);
  10065. }  /* do_psamplepick */
  10066.  
  10067. /*--------------------------------------------------------------------------*/
  10068.  
  10069. static void do_psamplestring()
  10070. {
  10071.   Pint wsid, dev, size;
  10072.   char string[255];
  10073.  
  10074.   wsid = readinteger("workstation identifier ? ");
  10075.   dev = readinteger("string device number ? ");
  10076.   psample_string(wsid, dev, string);
  10077.   if (writeinform)
  10078.   {
  10079.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10080.     phinprintf(PTKEINFORM, "string = \"%s\"\n", string); 
  10081.   }
  10082. }  /* do_psamplestring */
  10083.  
  10084. /*--------------------------------------------------------------------------*/
  10085.  
  10086. static void do_psamplestroke()
  10087. {
  10088.   Pint wsid, dev, size, view_index;
  10089.   Ppoint_list stroke;
  10090.   Ppoint pts[255];
  10091.  
  10092.   wsid = readinteger("workstation identifier ? ");
  10093.   dev = readinteger("stroke device number ? ");
  10094.   stroke.points = pts;
  10095.   psample_stroke(wsid, dev, &view_index, &stroke);
  10096.   if (writeinform)
  10097.   {
  10098.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10099.     phinprintf(PTKEINFORM, "view index = ");
  10100.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  10101.     phinprintf(PTKEINFORM, "number of points = ");
  10102.     writeinteger(PTKEINFORM, stroke.num_points);
  10103.     phinprintf(PTKEINFORM, "points:\n");
  10104.     writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
  10105.   }
  10106. }  /* do_psamplestroke */
  10107.  
  10108. /*--------------------------------------------------------------------------*/
  10109.  
  10110. static void do_psamplestroke3()
  10111. {
  10112.   Pint wsid, dev, size, view_index;
  10113.   Ppoint_list3 stroke;
  10114.   Ppoint3 pts[255];
  10115.  
  10116.   wsid = readinteger("workstation identifier ? ");
  10117.   dev = readinteger("stroke device number ? ");
  10118.   stroke.points = pts;
  10119.   psample_stroke3(wsid, dev, &view_index, &stroke);
  10120.   if (writeinform)
  10121.   {
  10122.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10123.     phinprintf(PTKEINFORM, "view index = ");
  10124.     writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
  10125.     phinprintf(PTKEINFORM, "number of points = ");
  10126.     writeinteger(PTKEINFORM, stroke.num_points);
  10127.     phinprintf(PTKEINFORM, "points:\n");
  10128.     writepointarray3(PTKEINFORM, stroke.num_points, stroke.points);
  10129.   }
  10130. }  /* do_psamplestroke3 */
  10131.  
  10132. /*--------------------------------------------------------------------------*/
  10133.  
  10134. static void do_psampleval()
  10135. {
  10136.   Pint wsid, dev;
  10137.   Pfloat val;
  10138.  
  10139.   wsid = readinteger("workstation identifier ? ");
  10140.   dev = readinteger("valuator device number ? ");
  10141.   psample_val(wsid, dev, &val);
  10142.   if (writeinform)
  10143.   {
  10144.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10145.     phinprintf(PTKEINFORM, "value = ");
  10146.     writereal(PTKEINFORM, val);
  10147.   }
  10148. }  /* do_psampleval */
  10149.  
  10150. /*--------------------------------------------------------------------------*/
  10151.  
  10152. static void do_pscale()
  10153. {
  10154.   Pvec scale;
  10155.   Pint err;
  10156.  
  10157.   scale = readvector("scale vector");
  10158.   pscale(&scale, &err, tm);
  10159.   if (writeinform)
  10160.   {
  10161.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10162.     if (err == 0)
  10163.     {
  10164.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  10165.       writematrix3(PTKEINFORM, tm);
  10166.     }
  10167.     else
  10168.       phigserror(PTKEINFORM, err);
  10169.   }
  10170. }  /* do_pscale */
  10171.  
  10172. /*--------------------------------------------------------------------------*/
  10173.  
  10174. static void do_pscale3()
  10175. {
  10176.   Pvec3 scale;
  10177.   Pint err;
  10178.  
  10179.   scale = readvector3("scale vector");
  10180.   pscale3(&scale, &err, tm3);
  10181.   if (writeinform)
  10182.   {
  10183.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10184.     if (err == 0)
  10185.     {
  10186.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  10187.       writematrix3(PTKEINFORM, tm3);
  10188.     }
  10189.     else
  10190.       phigserror(PTKEINFORM, err);
  10191.   }
  10192. }  /* do_pscale3 */
  10193.  
  10194. /*--------------------------------------------------------------------------*/
  10195.  
  10196. #include "psetfns.c"
  10197.  
  10198. /*--------------------------------------------------------------------------*/
  10199.  
  10200. static void do_ptext()
  10201. {
  10202.   Ppoint tp;
  10203.   char s[201];
  10204.  
  10205.   tp = readpoint("text origin");
  10206.   readquote(s, "text string ? ");
  10207.   ptext(&tp, s);
  10208. }  /* do_ptext */
  10209.  
  10210. /*--------------------------------------------------------------------------*/
  10211.  
  10212. static void do_ptext3()
  10213. {
  10214.   Ppoint3 tp;
  10215.   char s[201];
  10216.   Pvec3 td[2];
  10217.  
  10218.   tp = readpoint3("text origin");
  10219.   td[0] = readvector3("Reference point 1");
  10220.   td[1] = readvector3("Reference point 2");
  10221.   readquote(s, "text string ? ");
  10222.   ptext3(&tp, td, s);
  10223. }  /* do_ptext3 */
  10224.  
  10225. /*--------------------------------------------------------------------------*/
  10226.  
  10227. static void do_ptranpt()
  10228. {
  10229.   Ppoint pt, result;
  10230.   Pmatrix matrix;
  10231.   Pint err;
  10232.  
  10233.   pt = readpoint("point");
  10234.   readmatrix(matrix, "transformation matrix");
  10235.   ptran_point(&pt, matrix, &err, &result);
  10236.   if (writeinform)
  10237.   {
  10238.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10239.     if (err == 0)
  10240.     {
  10241.       phinprintf(PTKEINFORM, "transformed point:\n");
  10242.       writepoint(PTKEINFORM, &result);
  10243.     }
  10244.     else
  10245.       phigserror(PTKEINFORM, err);
  10246.   }
  10247. }  /* do_ptranpt */
  10248.  
  10249. /*--------------------------------------------------------------------------*/
  10250.  
  10251. static void do_ptranpt3()
  10252. {
  10253.   Ppoint3 pt, result;
  10254.   Pmatrix3 matrix;
  10255.   Pint err;
  10256.  
  10257.   pt = readpoint3("point");
  10258.   readmatrix3(matrix, "transformation matrix");
  10259.   ptran_point3(&pt, matrix, &err, &result);
  10260.   if (writeinform)
  10261.   {
  10262.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10263.     if (err == 0)
  10264.     {
  10265.       phinprintf(PTKEINFORM, "transformed point:\n");
  10266.       writepoint3(PTKEINFORM, &result);
  10267.     }
  10268.     else
  10269.       phigserror(PTKEINFORM, err);
  10270.   }
  10271. }  /* do_ptranpt3 */
  10272.  
  10273. /*--------------------------------------------------------------------------*/
  10274.  
  10275. static void do_ptranslate()
  10276. {
  10277.   Pvec transvector;
  10278.   Pint err;
  10279.  
  10280.   transvector = readvector("translation vector");
  10281.   ptranslate(&transvector, &err, tm);
  10282.   if (writeinform)
  10283.   {
  10284.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10285.     if (err == 0)
  10286.     {
  10287.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  10288.       writematrix(PTKEINFORM, tm);
  10289.     }
  10290.     else
  10291.       phigserror(PTKEINFORM, err);
  10292.   }
  10293. }  /* do_ptranslate */
  10294.  
  10295. /*--------------------------------------------------------------------------*/
  10296.  
  10297. static void do_ptranslate3()
  10298. {
  10299.   Pvec3 transvector;
  10300.   Pint err;
  10301.  
  10302.   transvector = readvector3("translation vector");
  10303.   ptranslate3(&transvector, &err, tm3);
  10304.   if (writeinform)
  10305.   {
  10306.     phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
  10307.     if (err == 0)
  10308.     {
  10309.       phinprintf(PTKEINFORM, "transformation matrix:\n");
  10310.       writematrix3(PTKEINFORM, tm3);
  10311.     }
  10312.     else
  10313.       phigserror(PTKEINFORM, err);
  10314.   }
  10315. }  /* do_ptranslate3 */
  10316.  
  10317. /*--------------------------------------------------------------------------*/
  10318.  
  10319. static void do_punpostallstruct()
  10320. {
  10321.   Pint wsid;
  10322.  
  10323.   wsid = readinteger("workstation identifier ? ");
  10324.   punpost_all_structs(wsid);
  10325. }  /* do_punpostallstruct */
  10326.  
  10327. /*--------------------------------------------------------------------------*/
  10328.  
  10329. static void do_punpoststruct()
  10330. {
  10331.   Pint ws_no, s_name;
  10332.  
  10333.   ws_no = readinteger("workstation identifier ? ");
  10334.   s_name = readintvalue("structure identifier ? ", PTKESTRUCTID);
  10335.   punpost_struct(ws_no, s_name);
  10336. }  /* do_punpoststruct */
  10337.  
  10338. /*--------------------------------------------------------------------------*/
  10339.  
  10340. static void do_pupdatews()
  10341. {
  10342.   Pint wsid;
  10343.   Pregen_flag reg;
  10344.  
  10345.   wsid = readinteger("workstation identifier ? ");
  10346.   reg = readphigsenum(PTKEREGEN, "regeneration flag ? ");
  10347.   pupd_ws(wsid, reg);
  10348. }  /* do_pupdatews */
  10349.  
  10350. /*--------------------------------------------------------------------------*/
  10351.  
  10352. static void do_pwritemf()
  10353. {
  10354.   phintererror(1, (char *)NULL, INFORM);
  10355. }  /* do_pwritemf */
  10356.  
  10357. /*--------------------------------------------------------------------------*/
  10358.  
  10359. /* PHIGS PLUS functions */
  10360. #ifdef SUN
  10361. #include "plusfns.c"
  10362. #endif
  10363.  
  10364. /*--------------------------------------------------------------------------*/
  10365. /*------------------------- phinter functions ------------------------------*/
  10366. /*--------------------------------------------------------------------------*/
  10367.  
  10368. static void process_phigs_function(C(ptkephigsnames) phigsname)
  10369. PreANSI(ptkephigsnames phigsname)
  10370. /* This routine processes the PHIGS function whose namelist index is 
  10371. ** phigsname.
  10372. */
  10373. {
  10374.   /* write out the function name onto an output script if required */
  10375.   if (writingscript)
  10376.     phinprintf(PTKEOUTPUT, "%s\n", phigsnamelist[(Pint)phigsname]);
  10377.   activefunction = (Pint)phigsname;
  10378.   switch (phigsname) 
  10379.   {
  10380.     case PTKEADDNAMESET: do_paddnameset();
  10381.             break;
  10382.                 
  10383.     case PTKEANNOTATIONTEXTRELATIVE: do_pannotationtextrelative();
  10384.             break;
  10385.     
  10386.     case PTKEANNOTATIONTEXTRELATIVE3: do_pannotationtextrelative3();
  10387.             break;
  10388.    
  10389.     case PTKEAPPLICATIONDATA: do_papplicationdata();
  10390.             break;
  10391.            
  10392.     case PTKEARALLSTRUCT: do_parallstruct();
  10393.             break;
  10394.                
  10395.     case PTKEARSTRUCT: do_parstruct();
  10396.             break;
  10397.                   
  10398.     case PTKEARSTRUCTNET: do_parstructnet();
  10399.             break;
  10400.                
  10401.     case PTKEAWAITEVENT: do_pawait_event();
  10402.             break;
  10403.                 
  10404.     case PTKEBUILDTRAN: do_pbuildtran();
  10405.             break;
  10406.                  
  10407.     case PTKEBUILDTRAN3: do_pbuildtran3();
  10408.             break;
  10409.  
  10410.     case PTKECELLARRAY: do_pcellarray();
  10411.             break;
  10412.  
  10413.     case PTKECELLARRAY3: do_pcellarray3();
  10414.             break;
  10415.                 
  10416.     case PTKECHANGESTRUCTID: do_pchangestructid();
  10417.             break;
  10418.             
  10419.     case PTKECHANGESTRUCTIDREF: do_pchangestructidref();
  10420.             break;
  10421.          
  10422.     case PTKECHANGESTRUCTREF: do_pchangestructref();
  10423.             break;
  10424.            
  10425.     case PTKECLOSEARFILE: do_pclosearfile();
  10426.             break;
  10427.                
  10428.     case PTKECLOSEPHIGS: do_pclosephigs();
  10429.             break;
  10430.                 
  10431.     case PTKECLOSESTRUCT: do_pclosestruct();
  10432.             break;
  10433.                
  10434.     case PTKECLOSEWS: do_pclosews();
  10435.             break;
  10436.                    
  10437.     case PTKECOMPOSEMATRIX: do_pcomposematrix();
  10438.             break;
  10439.              
  10440.     case PTKECOMPOSEMATRIX3: do_pcomposematrix3();
  10441.             break;
  10442.             
  10443.     case PTKECOMPOSETRAN: do_pcomposetran();
  10444.             break;
  10445.                
  10446.     case PTKECOMPOSETRAN3: do_pcomposetran3();
  10447.             break;
  10448.               
  10449.     case PTKECOPYALLELEMSSTRUCT: do_pcopyallelemsstruct();
  10450.             break;
  10451.         
  10452.     case PTKEDELALLSTRUCT: do_pdelallstruct();
  10453.             break;
  10454.               
  10455.     case PTKEDELALLSTRUCTAR: do_pdelallstructar();
  10456.             break;
  10457.             
  10458.     case PTKEDELELEM: do_pdelelem();
  10459.             break;
  10460.                    
  10461.     case PTKEDELELEMRANGE: do_pdelelemrange();
  10462.             break;
  10463.               
  10464.     case PTKEDELELEMSLABELS: do_pdelelemslabels();
  10465.             break;
  10466.             
  10467.     case PTKEDELSTRUCT: do_pdelstruct();
  10468.             break;
  10469.                  
  10470.     case PTKEDELSTRUCTAR: do_pdelstructar();
  10471.             break;
  10472.                
  10473.     case PTKEDELSTRUCTNET: do_pdelstructnet();
  10474.             break;
  10475.               
  10476.     case PTKEDELSTRUCTNETAR: do_pdelstructnetar();
  10477.             break;
  10478.             
  10479.     case PTKEELEMSRCH: do_pelemsrch();
  10480.             break;
  10481.                   
  10482.     case PTKEEMERGENCYCLOSEPHIGS: do_pemergencyclosephigs();
  10483.             break;
  10484.        
  10485.     case PTKEEMPTYSTRUCT: do_pemptystruct();
  10486.             break;
  10487.                
  10488.     case PTKEERRORHAND: do_perrorhand();
  10489.             break;
  10490.                  
  10491.     case PTKEERRORLOG: do_perrorlog();
  10492.             break;
  10493.                   
  10494.     case PTKEESCAPE: do_pescape();
  10495.             break;
  10496.  
  10497.     case PTKEEVALVIEWMAPPINGMATRIX: do_pevalviewmappingmatrix();
  10498.             break;
  10499.      
  10500.     case PTKEEVALVIEWMAPPINGMATRIX3: do_pevalviewmappingmatrix3();
  10501.             break;
  10502.     
  10503.     case PTKEEVALVIEWORIENTATIONMATRIX: do_pevalvieworientationmatrix();
  10504.             break;
  10505.  
  10506.     case PTKEEVALVIEWORIENTATIONMATRIX3: do_pevalvieworientationmatrix3();
  10507.             break;
  10508.  
  10509.     case PTKEEXECUTESTRUCT: do_pexecutestruct();
  10510.             break;
  10511.              
  10512.     case PTKEFILLAREA: do_pfillarea();
  10513.             break;
  10514.                   
  10515.     case PTKEFILLAREA3: do_pfillarea3();
  10516.             break;
  10517.                  
  10518.     case PTKEFILLAREASET: do_pfillareaset();
  10519.             break;
  10520.  
  10521.     case PTKEFILLAREASET3: do_pfillareaset3();
  10522.             break;
  10523.               
  10524.     case PTKEFLUSHEVENTS: do_pflush_events();
  10525.             break;
  10526.  
  10527.     case PTKEGDP: do_pgdp();
  10528.             break;
  10529.  
  10530.     case PTKEGDP3: do_pgdp3();
  10531.             break;
  10532.                
  10533.     case PTKEGSE: do_pgse();
  10534.             break;
  10535.  
  10536.     case PTKEGETCHOICE: do_pget_choice();
  10537.             break;
  10538.  
  10539.     case PTKEGETTYPEMF: do_pgettypemf();
  10540.             break;
  10541.                  
  10542.     case PTKEGETLOC: do_pget_loc();
  10543.             break;
  10544.                     
  10545.     case PTKEGETLOC3: do_pget_loc3();
  10546.             break;
  10547.                    
  10548.     case PTKEGETPICK: do_pget_pick();
  10549.             break;
  10550.                    
  10551.     case PTKEGETSTRING: do_pget_string();
  10552.             break;
  10553.                  
  10554.     case PTKEGETSTROKE: do_pget_stroke();
  10555.             break;
  10556.                  
  10557.     case PTKEGETSTROKE3: do_pget_stroke3();
  10558.             break;
  10559.                 
  10560.     case PTKEGETVAL: do_pget_val();
  10561.             break;
  10562.  
  10563.     case PTKEINCRSPASRCH: do_pincrspasrch();
  10564.             break;
  10565.  
  10566.     case PTKEINCRSPASRCH3: do_pincrspasrch3();
  10567.             break;
  10568.                     
  10569.     case PTKEINITCHOICE: do_pinit_choice();
  10570.             break;
  10571.                 
  10572.     case PTKEINITCHOICE3: do_pinit_choice3();
  10573.             break;
  10574.                
  10575.     case PTKEINITLOC: do_pinit_loc();
  10576.             break;
  10577.                    
  10578.     case PTKEINITLOC3: do_pinit_loc3();
  10579.             break;
  10580.                   
  10581.     case PTKEINITPICK: do_pinit_pick();
  10582.             break;
  10583.                   
  10584.     case PTKEINITPICK3: do_pinit_pick3();
  10585.             break;
  10586.                  
  10587.     case PTKEINITSTRING: do_pinit_string();
  10588.             break;
  10589.                 
  10590.     case PTKEINITSTRING3: do_pinit_string3();
  10591.             break;
  10592.                
  10593.     case PTKEINITSTROKE: do_pinit_stroke();
  10594.             break;
  10595.                 
  10596.     case PTKEINITSTROKE3: do_pinit_stroke3();
  10597.             break;
  10598.                
  10599.     case PTKEINITVAL: do_pinit_val();
  10600.             break;
  10601.                    
  10602.     case PTKEINITVAL3: do_pinit_val3();
  10603.             break;
  10604.                   
  10605.     case PTKEINQANCESSTRUCT: do_pinq_paths_ances();
  10606.             break;
  10607.  
  10608.     case PTKEINQANNOTATIONFACIL: do_pinq_anno_facs();
  10609.             break;
  10610.             
  10611.     case PTKEINQARFILES: do_pinq_ar_files();
  10612.             break;
  10613.                 
  10614.     case PTKEINQARST: do_pinq_ar_st();
  10615.             break;
  10616.                    
  10617.     case PTKEINQCHOICEST: do_pinq_choice_st();
  10618.             break;
  10619.                
  10620.     case PTKEINQCHOICEST3: do_pinq_choice_st3();
  10621.             break;
  10622.               
  10623.     case PTKEINQCOLOURFACIL: do_pinq_colr_facs();
  10624.             break;
  10625.             
  10626.     case PTKEINQCOLOURMODEL: do_pinq_colr_model();
  10627.             break;
  10628.             
  10629.     case PTKEINQCOLOURMODELFACIL: do_pinq_colr_model_facs();
  10630.             break;
  10631.        
  10632.     case PTKEINQCOLOURREP: do_pinq_colr_rep();
  10633.             break;
  10634.               
  10635.     case PTKEINQCONFRES: do_pinq_conf_res();
  10636.             break;
  10637.                 
  10638.     case PTKEINQALLCONFSTRUCT: do_pinq_all_conf_structs();
  10639.             break;
  10640.           
  10641.     case PTKEINQCONFSTRUCTINNET: do_pinq_conf_structs_net();
  10642.             break;
  10643.         
  10644.     case PTKEINQCURELEMCONTENT: do_pinq_cur_elem_content();
  10645.             break;
  10646.          
  10647.     case PTKEINQCURELEMTYPESIZE: do_pinq_cur_elem_type_size();
  10648.             break;
  10649.         
  10650.     case PTKEINQDEFCHOICEDATA: do_pinq_def_choice_data();
  10651.             break;
  10652.           
  10653.     case PTKEINQDEFCHOICEDATA3: do_pinq_def_choice_data3();
  10654.             break;
  10655.          
  10656.     case PTKEINQDEFDISPLAYUPDATEST: do_pinq_def_disp_upd_st();
  10657.             break;
  10658.      
  10659.     case PTKEINQDEFLOCDATA: do_pinq_def_loc_data();
  10660.             break;
  10661.              
  10662.     case PTKEINQDEFLOCDATA3: do_pinq_def_loc_data3();
  10663.             break;
  10664.             
  10665.     case PTKEINQDEFPICKDATA: do_pinq_def_pick_data();
  10666.             break;
  10667.             
  10668.     case PTKEINQDEFPICKDATA3: do_pinq_def_pick_data3();
  10669.             break;
  10670.            
  10671.     case PTKEINQDEFSTRINGDATA: do_pinq_def_string_data();
  10672.             break;
  10673.           
  10674.     case PTKEINQDEFSTRINGDATA3: do_pinq_def_string_data3();
  10675.             break;
  10676.          
  10677.     case PTKEINQDEFSTROKEDATA: do_pinq_def_stroke_data();
  10678.             break;
  10679.  
  10680.     case PTKEINQDEFSTROKEDATA3: do_pinq_def_stroke_data3();
  10681.             break;
  10682.          
  10683.     case PTKEINQDEFVALDATA: do_pinq_def_val_data();
  10684.             break;
  10685.              
  10686.     case PTKEINQDEFVALDATA3: do_pinq_def_val_data3();
  10687.             break;
  10688.  
  10689.     case PTKEINQDESCSTRUCT: do_pinq_paths_descs();
  10690.             break;
  10691.             
  10692.     case PTKEINQDISPLAYSPACESIZE: do_pinqdisplayspacesize();
  10693.             break;
  10694.  
  10695.     case PTKEINQDISPLAYSPACESIZE3: do_pinqdisplayspacesize3();
  10696.             break;
  10697.        
  10698.     case PTKEINQDISPLAYUPDATEST: do_pinqdisplayupdatest();
  10699.             break;
  10700.         
  10701.     case PTKEINQDYNSTRUCT: do_pinqdynstruct();
  10702.             break;
  10703.               
  10704.     case PTKEINQDYNWSATTR: do_pinqdynwsattr();
  10705.             break;
  10706.               
  10707.     case PTKEINQEDGEFACIL: do_pinqedgefacil();
  10708.             break;
  10709.               
  10710.     case PTKEINQEDGEREP: do_pinqedgerep();
  10711.             break;
  10712.                 
  10713.     case PTKEINQEDITMODE: do_pinqeditmode();
  10714.             break;
  10715.                
  10716.     case PTKEINQELEMCONTENT: do_pinqelemcontent();
  10717.             break;
  10718.             
  10719.     case PTKEINQELEMPTR: do_pinqelemptr();
  10720.             break;
  10721.                 
  10722.     case PTKEINQELEMTYPESIZE: do_pinqelemtypesize();
  10723.             break;
  10724.            
  10725.     case PTKEINQERRORHANDMODE: do_pinqerrorhandmode();
  10726.             break;
  10727.           
  10728.     case PTKEINQGDP: do_pinqgdp();
  10729.             break;
  10730.  
  10731.     case PTKEINQGDP3: do_pinqgdp3();
  10732.             break;
  10733.  
  10734.     case PTKEINQGSEFACIL: do_pinqgsefacil();
  10735.             break;
  10736.                
  10737.     case PTKEINQHILIGHTFILTER: do_pinqhilightfilter();
  10738.             break;
  10739.           
  10740.     case PTKEINQHLHSRFACIL: do_pinqhlhsrfacil();
  10741.             break;
  10742.              
  10743.     case PTKEINQHLHSRMODE: do_pinqhlhsrmode();
  10744.             break;
  10745.               
  10746.     case PTKEINQINPUTOVERFLOW: do_pinqinputoverflow();
  10747.             break;
  10748.  
  10749.     case PTKEINQINTFACIL: do_pinqintfacil();
  10750.             break;
  10751.                
  10752.     case PTKEINQINTREP: do_pinqintrep();
  10753.             break;
  10754.                  
  10755.     case PTKEINQINVISFILTER: do_pinqinvisfilter();
  10756.             break;
  10757.  
  10758.     case PTKEINQAVAILGDP: do_pinqavailgdp();
  10759.             break;
  10760.  
  10761.     case PTKEINQAVAILGDP3: do_pinqavailgdp3();
  10762.             break;
  10763.             
  10764.     case PTKEINQGSE: do_pinqgse();
  10765.             break;
  10766.  
  10767.     case PTKEINQWSTYPES: do_pinqwstypes();
  10768.             break;
  10769.  
  10770.     case PTKEINQCOLOURIND: do_pinqcolourind();
  10771.             break;
  10772.  
  10773.     case PTKEINQEDGEIND: do_pinqedgeind();
  10774.             break;
  10775.  
  10776.     case PTKEINQINTIND: do_pinqintind();
  10777.             break;
  10778.  
  10779.     case PTKEINQPATIND: do_pinqpatind();
  10780.             break;
  10781.  
  10782.     case PTKEINQLINEIND: do_pinqlineind();
  10783.             break;
  10784.  
  10785.     case PTKEINQMARKERIND: do_pinqmarkerind();
  10786.             break;
  10787.  
  10788.     case PTKEINQTEXTIND: do_pinqtextind();
  10789.             break;
  10790.  
  10791.     case PTKEINQVIEWIND: do_pinqviewind();
  10792.             break;
  10793.  
  10794.     case PTKEINQLINEFACIL: do_pinqlinefacil();
  10795.             break;
  10796.               
  10797.     case PTKEINQLINEREP: do_pinqlinerep();
  10798.             break;
  10799.                 
  10800.     case PTKEINQLOCST: do_pinqlocst();
  10801.             break;
  10802.                   
  10803.     case PTKEINQLOCST3: do_pinqlocst3();
  10804.             break;
  10805.  
  10806.     case PTKEINQMODELCLIPFACIL: do_pinqmodelclipfacil();
  10807.             break;
  10808.                  
  10809.     case PTKEINQMARKERFACIL: do_pinqmarkerfacil();
  10810.             break;
  10811.             
  10812.     case PTKEINQMARKERREP: do_pinqmarkerrep();
  10813.             break;
  10814.               
  10815.     case PTKEINQMOREEVENTS: do_pinqmoreevents();
  10816.             break;
  10817.              
  10818.     case PTKEINQNUMINPUT: do_pinqnuminput();
  10819.             break;
  10820.                
  10821.     case PTKEINQNUMDISPLAYPRI: do_pinqnumdisplaypri();
  10822.             break;
  10823.           
  10824.     case PTKEINQOPENSTRUCT: do_pinqopenstruct();
  10825.             break;
  10826.  
  10827.     case PTKEINQPATFACIL: do_pinqpatfacil();
  10828.             break;
  10829.  
  10830.     case PTKEINQPATREP: do_pinqpatrep();
  10831.             break;
  10832.              
  10833.     case PTKEINQPHIGSFACIL: do_pinqphigsfacil();
  10834.             break;
  10835.              
  10836.     case PTKEINQPICKST: do_pinqpickst();
  10837.             break;
  10838.  
  10839.     case PTKEINQPICKST3: do_pinqpickst3();
  10840.             break;
  10841.  
  10842.     case PTKEINQPOSTEDSTRUCT: do_pinqpostedstruct();
  10843.             break;
  10844.            
  10845.     case PTKEINQPREDCOLOURREP: do_pinqpredcolourrep();
  10846.             break;
  10847.           
  10848.     case PTKEINQPREDEDGEREP: do_pinqprededgerep();
  10849.             break;
  10850.             
  10851.     case PTKEINQPREDINTREP: do_pinqpredintrep();
  10852.             break;
  10853.              
  10854.     case PTKEINQPREDPATREP: do_pinqpredpatrep();
  10855.             break;
  10856.  
  10857.     case PTKEINQPREDLINEREP: do_pinqpredlinerep();
  10858.             break;
  10859.             
  10860.     case PTKEINQPREDMARKERREP: do_pinqpredmarkerrep();
  10861.             break;
  10862.           
  10863.     case PTKEINQPREDTEXTREP: do_pinqpredtextrep();
  10864.             break;
  10865.             
  10866.     case PTKEINQPREDVIEWREP: do_pinqpredviewrep();
  10867.             break;
  10868.  
  10869.     case PTKEINQSETOPENWS: do_pinqsetopenws();
  10870.             break;
  10871.             
  10872.     case PTKEINQSTRINGST: do_pinqstringst();
  10873.             break;
  10874.                
  10875.     case PTKEINQSTRINGST3: do_pinqstringst3();
  10876.             break;
  10877.               
  10878.     case PTKEINQSTROKEST: do_pinqstrokest();
  10879.             break;
  10880.                
  10881.     case PTKEINQSTROKEST3: do_pinqstrokest3();
  10882.             break;
  10883.               
  10884.     case PTKEINQSTRUCTIDS: do_pinqstructids();
  10885.             break;
  10886.               
  10887.     case PTKEINQSTRUCTST: do_pinqstructst();
  10888.             break;
  10889.                
  10890.     case PTKEINQSTRUCTSTATUS: do_pinqstructstatus();
  10891.             break;
  10892.            
  10893.     case PTKEINQSYSTEMST: do_pinqsystemst();
  10894.             break;
  10895.                
  10896.     case PTKEINQTEXTEXTENT: do_pinqtextextent();
  10897.             break;
  10898.              
  10899.     case PTKEINQTEXTFACIL: do_pinqtextfacil();
  10900.             break;
  10901.               
  10902.     case PTKEINQTEXTREP: do_pinqtextrep();
  10903.             break;
  10904.                 
  10905.     case PTKEINQVALST: do_pinqvalst();
  10906.             break;
  10907.                   
  10908.     case PTKEINQVALST3: do_pinqvalst3();
  10909.             break;
  10910.                  
  10911.     case PTKEINQVIEWFACIL: do_pinqviewfacil();
  10912.             break;
  10913.               
  10914.     case PTKEINQVIEWREP: do_pinqviewrep();
  10915.             break;
  10916.                 
  10917.     case PTKEINQWSCATEGORY: do_pinqwscategory();
  10918.             break;
  10919.              
  10920.     case PTKEINQWSCLASS: do_pinqwsclass();
  10921.             break;
  10922.                 
  10923.     case PTKEINQWSCONNTYPE: do_pinqwsconntype();
  10924.             break;
  10925.              
  10926.     case PTKEINQSETWSPOSTED: do_pinqsetwsposted();
  10927.             break;
  10928.             
  10929.     case PTKEINQWSST: do_pinqwsst();
  10930.             break;
  10931.                    
  10932.     case PTKEINQWSSTTABLE: do_pinqwssttable();
  10933.             break;
  10934.               
  10935.     case PTKEINQWSTRAN: do_pinqwstran();
  10936.             break;
  10937.                  
  10938.     case PTKEINQWSTRAN3: do_pinqwstran3();
  10939.             break;
  10940.  
  10941.     case PTKEINTERPRET: do_pinterpret();
  10942.             break;
  10943.                 
  10944.     case PTKELABEL: do_plabel();
  10945.             break;
  10946.                      
  10947.     case PTKEMESSAGE: do_pmessage();
  10948.             break;
  10949.                    
  10950.     case PTKEOFFSETELEMPTR: do_poffsetelemptr();
  10951.             break;
  10952.              
  10953.     case PTKEOPENARFILE: do_popenarfile();
  10954.             break;
  10955.                 
  10956.     case PTKEOPENPHIGS: do_popenphigs();
  10957.             break;
  10958.                  
  10959.     case PTKEOPENSTRUCT: do_popenstruct();
  10960.             break;
  10961.                 
  10962.     case PTKEOPENWS: do_popenws();
  10963.             break;
  10964.                     
  10965.     case PTKEPOLYLINE: do_ppolyline();
  10966.             break;
  10967.                   
  10968.     case PTKEPOLYLINE3: do_ppolyline3();
  10969.             break;
  10970.                  
  10971.     case PTKEPOLYMARKER: do_ppolymarker();
  10972.             break;
  10973.                 
  10974.     case PTKEPOLYMARKER3: do_ppolymarker3();
  10975.             break;
  10976.                
  10977.     case PTKEPOSTSTRUCT: do_ppoststruct();
  10978.             break;
  10979.  
  10980.     case PTKEREADMF: do_preadmf();
  10981.             break;
  10982.                 
  10983.     case PTKEREDRAWALLSTRUCT: do_predrawallstruct();
  10984.             break;
  10985.            
  10986.     case PTKEREMOVENAMESET: do_premovenameset();
  10987.             break;
  10988.              
  10989.     case PTKEREQCHOICE: do_preqchoice();
  10990.             break;
  10991.                  
  10992.     case PTKEREQLOC: do_preqloc();
  10993.             break;
  10994.                     
  10995.     case PTKEREQLOC3: do_preqloc3();
  10996.             break;
  10997.                    
  10998.     case PTKEREQPICK: do_preqpick();
  10999.             break;
  11000.                    
  11001.     case PTKEREQSTRING: do_preqstring();
  11002.             break;
  11003.                  
  11004.     case PTKEREQSTROKE: do_preqstroke();
  11005.             break;
  11006.                  
  11007.     case PTKEREQSTROKE3: do_preqstroke3();
  11008.             break;
  11009.                 
  11010.     case PTKEREQVAL: do_preqval();
  11011.             break;
  11012.  
  11013.     case PTKERESTOREMODELCLIPVOLUME: do_prestoremodelclipvolume();
  11014.             break;
  11015.  
  11016.     case PTKERETRIEVEALLSTRUCT: do_pretrieveallstruct();
  11017.             break;
  11018.  
  11019.     case PTKERETRIEVEANCESSTRUCT: do_pretrieveancesstruct();
  11020.             break;
  11021.  
  11022.     case PTKERETRIEVEDESCSTRUCT: do_pretrievedescstruct();
  11023.             break;
  11024.          
  11025.     case PTKERETRIEVESTRUCTIDS: do_pretrievestructids();
  11026.             break;
  11027.          
  11028.     case PTKERETRIEVESTRUCT: do_pretrievestruct();
  11029.             break;
  11030.            
  11031.     case PTKERETRIEVESTRUCTNET: do_pretrievestructnet();
  11032.             break;
  11033.           
  11034.     case PTKEROTATE: do_protate();
  11035.             break;
  11036.                     
  11037.     case PTKEROTATEX: do_protatex();
  11038.             break;
  11039.                    
  11040.     case PTKEROTATEY: do_protatey();
  11041.             break;
  11042.                    
  11043.     case PTKEROTATEZ: do_protatez();
  11044.             break;
  11045.                    
  11046.     case PTKESAMPLECHOICE: do_psamplechoice();
  11047.             break;
  11048.               
  11049.     case PTKESAMPLELOC: do_psampleloc();
  11050.             break;
  11051.                  
  11052.     case PTKESAMPLELOC3: do_psampleloc3();
  11053.             break;
  11054.                 
  11055.     case PTKESAMPLEPICK: do_psamplepick();
  11056.             break;
  11057.                 
  11058.     case PTKESAMPLESTRING: do_psamplestring();
  11059.             break;
  11060.               
  11061.     case PTKESAMPLESTROKE: do_psamplestroke();
  11062.             break;
  11063.               
  11064.     case PTKESAMPLESTROKE3: do_psamplestroke3();
  11065.             break;
  11066.              
  11067.     case PTKESAMPLEVAL: do_psampleval();
  11068.             break;
  11069.                  
  11070.     case PTKESCALE: do_pscale();
  11071.             break;
  11072.                      
  11073.     case PTKESCALE3: do_pscale3();
  11074.             break;
  11075.                     
  11076.     case PTKESETANNOTATIONALIGN: do_psetannotationalign();
  11077.             break;
  11078.         
  11079.     case PTKESETANNOTATIONCHARHEIGHT: do_psetannotationcharheight();
  11080.             break;
  11081.    
  11082.     case PTKESETANNOTATIONCHARUP: do_psetannotationcharup();
  11083.             break;
  11084.        
  11085.     case PTKESETANNOTATIONPATH: do_psetannotationpath();
  11086.             break;
  11087.          
  11088.     case PTKESETANNOTATIONSTYLE: do_psetannotationstyle();
  11089.             break;
  11090.         
  11091.     case PTKESETCHAREXPAN: do_psetcharexpan();
  11092.             break;
  11093.               
  11094.     case PTKESETCHARHEIGHT: do_psetcharheight();
  11095.             break;
  11096.              
  11097.     case PTKESETCHARSPACE: do_psetcharspace();
  11098.             break;
  11099.               
  11100.     case PTKESETCHARUP: do_psetcharup();
  11101.             break;
  11102.                  
  11103.     case PTKESETCHOICEMODE: do_psetchoicemode();
  11104.             break;
  11105.              
  11106.     case PTKESETCOLOURMODEL: do_psetcolourmodel();
  11107.             break;
  11108.             
  11109.     case PTKESETCOLOURREP: do_psetcolourrep();
  11110.             break;
  11111.               
  11112.     case PTKESETCONFRES: do_psetconfres();
  11113.             break;
  11114.                 
  11115.     case PTKESETDISPLAYUPDATEST: do_psetdisplayupdatest();
  11116.             break;
  11117.         
  11118.     case PTKESETEDGECOLOURIND: do_psetedgecolourind();
  11119.             break;
  11120.           
  11121.     case PTKESETEDGEFLAG: do_psetedgeflag();
  11122.             break;
  11123.                
  11124.     case PTKESETEDGEIND: do_psetedgeind();
  11125.             break;
  11126.                 
  11127.     case PTKESETEDGEREP: do_psetedgerep();
  11128.             break;
  11129.                 
  11130.     case PTKESETEDGEWIDTH: do_psetedgewidth();
  11131.             break;
  11132.               
  11133.     case PTKESETEDGETYPE: do_psetedgetype();
  11134.             break;
  11135.                
  11136.     case PTKESETEDITMODE: do_pseteditmode();
  11137.             break;
  11138.                
  11139.     case PTKESETELEMPTR: do_psetelemptr();
  11140.             break;
  11141.                 
  11142.     case PTKESETELEMPTRLABEL: do_psetelemptrlabel();
  11143.             break;
  11144.            
  11145.     case PTKESETERRORHANDMODE: do_pseterrorhandmode();
  11146.             break;
  11147.           
  11148.     case PTKESETGLOBALTRAN: do_psetglobaltran();
  11149.             break;
  11150.              
  11151.     case PTKESETGLOBALTRAN3: do_psetglobaltran3();
  11152.             break;
  11153.             
  11154.     case PTKESETHLHSRID: do_psethlhsrid();
  11155.             break;
  11156.                 
  11157.     case PTKESETHLHSRMODE: do_psethlhsrmode();
  11158.             break;
  11159.               
  11160.     case PTKESETHILIGHTFILTER: do_psethilightfilter();
  11161.             break;
  11162.           
  11163.     case PTKESETINDIVASF: do_psetindivasf();
  11164.             break;
  11165.                
  11166.     case PTKESETINTCOLOURIND: do_psetintcolourind();
  11167.             break;
  11168.  
  11169.     case PTKESETINTIND: do_psetintind();
  11170.             break;
  11171.            
  11172.     case PTKESETINTREP: do_psetintrep();
  11173.             break;
  11174.                  
  11175.     case PTKESETINTSTYLE: do_psetintstyle();
  11176.             break;
  11177.                
  11178.     case PTKESETINTSTYLEIND: do_psetintstyleind();
  11179.             break;
  11180.             
  11181.     case PTKESETINVISFILTER: do_psetinvisfilter();
  11182.             break;
  11183.             
  11184.     case PTKESETLINECOLOURIND: do_psetlinecolourind();
  11185.             break;
  11186.           
  11187.     case PTKESETLINEWIDTH: do_psetlinewidth();
  11188.             break;
  11189.               
  11190.     case PTKESETLINETYPE: do_psetlinetype();
  11191.             break;
  11192.                
  11193.     case PTKESETLOCALTRAN: do_psetlocaltran();
  11194.             break;
  11195.               
  11196.     case PTKESETLOCALTRAN3: do_psetlocaltran3();
  11197.             break;
  11198.              
  11199.     case PTKESETLOCMODE: do_psetlocmode();
  11200.             break;
  11201.                 
  11202.     case PTKESETMARKERCOLOURIND: do_psetmarkercolourind();
  11203.             break;
  11204.         
  11205.     case PTKESETMARKERSIZE: do_psetmarkersize();
  11206.             break;
  11207.              
  11208.     case PTKESETMARKERTYPE: do_psetmarkertype();
  11209.             break;
  11210.  
  11211.     case PTKESETMODELCLIPINDICATOR: do_psetmodelclipindicator();
  11212.             break;
  11213.  
  11214.     case PTKESETMODELCLIPVOLUME: do_psetmodelclipvolume();
  11215.             break;
  11216.  
  11217.     case PTKESETMODELCLIPVOLUME3: do_psetmodelclipvolume3();
  11218.             break;
  11219.              
  11220.     case PTKESETPATREFPT: do_psetpatrefpt();
  11221.             break;
  11222.  
  11223.     case PTKESETPATREFPTVECTORS: do_psetpatrefptvectors();
  11224.             break;
  11225.  
  11226.     case PTKESETPATREP: do_psetpatrep();
  11227.             break;
  11228.  
  11229.     case PTKESETPATSIZE: do_psetpatsize();
  11230.             break;
  11231.  
  11232.     case PTKESETPICKFILTER: do_psetpickfilter();
  11233.             break;
  11234.              
  11235.     case PTKESETPICKID: do_psetpickid();
  11236.             break;
  11237.                  
  11238.     case PTKESETPICKMODE: do_psetpickmode();
  11239.             break;
  11240.                
  11241.     case PTKESETLINEIND: do_psetlineind();
  11242.             break;
  11243.                 
  11244.     case PTKESETLINEREP: do_psetlinerep();
  11245.             break;
  11246.                 
  11247.     case PTKESETMARKERIND: do_psetmarkerind();
  11248.             break;
  11249.               
  11250.     case PTKESETMARKERREP: do_psetmarkerrep();
  11251.             break;
  11252.               
  11253.     case PTKESETSTRINGMODE: do_psetstringmode();
  11254.             break;
  11255.              
  11256.     case PTKESETSTROKEMODE: do_psetstrokemode();
  11257.             break;
  11258.              
  11259.     case PTKESETTEXTALIGN: do_psettextalign();
  11260.             break;
  11261.               
  11262.     case PTKESETTEXTCOLOURIND: do_psettextcolourind();
  11263.             break;
  11264.           
  11265.     case PTKESETTEXTFONT: do_psettextfont();
  11266.             break;
  11267.                
  11268.     case PTKESETTEXTIND: do_psettextind();
  11269.             break;
  11270.                 
  11271.     case PTKESETTEXTPATH: do_psettextpath();
  11272.             break;
  11273.                
  11274.     case PTKESETTEXTPREC: do_psettextprec();
  11275.             break;
  11276.                
  11277.     case PTKESETTEXTREP: do_psettextrep();
  11278.             break;
  11279.                 
  11280.     case PTKESETVALMODE: do_psetvalmode();
  11281.             break;
  11282.                 
  11283.     case PTKESETVIEWIND: do_psetviewind();
  11284.             break;
  11285.                 
  11286.     case PTKESETVIEWREP: do_psetviewrep();
  11287.             break;
  11288.                 
  11289.     case PTKESETVIEWREP3: do_psetviewrep3();
  11290.             break;
  11291.                
  11292.     case PTKESETVIEWTRANINPUTPRI: do_psetviewtraninputpri();
  11293.             break;
  11294.        
  11295.     case PTKESETWSVIEWPORT: do_psetwsviewport();
  11296.             break;
  11297.              
  11298.     case PTKESETWSVIEWPORT3: do_psetwsviewport3();
  11299.             break;
  11300.             
  11301.     case PTKESETWSWINDOW: do_psetwswindow();
  11302.             break;
  11303.                
  11304.     case PTKESETWSWINDOW3: do_psetwswindow3();
  11305.             break;
  11306.               
  11307.     case PTKETEXT: do_ptext();
  11308.             break;
  11309.                       
  11310.     case PTKETEXT3: do_ptext3();
  11311.             break;
  11312.                      
  11313.     case PTKETRANPT: do_ptranpt();
  11314.             break;
  11315.                     
  11316.     case PTKETRANPT3: do_ptranpt3();
  11317.             break;
  11318.                    
  11319.     case PTKETRANSLATE: do_ptranslate();
  11320.             break;
  11321.                  
  11322.     case PTKETRANSLATE3: do_ptranslate3();
  11323.             break;
  11324.                 
  11325.     case PTKEUNPOSTALLSTRUCT: do_punpostallstruct();
  11326.             break;
  11327.            
  11328.     case PTKEUNPOSTSTRUCT: do_punpoststruct();
  11329.             break;
  11330.               
  11331.     case PTKEUPDATEWS: do_pupdatews();
  11332.             break;
  11333.  
  11334.     case PTKEWRITEMF: do_pwritemf();
  11335.             break;
  11336.  
  11337. /* PHIGS PLUS bits */
  11338. #ifdef SUN
  11339.     case PTKECELLARRAY3PLUS: do_pcellarray3plus();
  11340.       break;
  11341.  
  11342.     case PTKECOMPFILLAREASETGNORM: do_pcompfillareasetgnorm();
  11343.       break;
  11344.  
  11345.     case PTKEFILLAREASETDATA: do_pfillareasetdata();
  11346.       break;
  11347.  
  11348.     case PTKEFILLAREASET3DATA: do_pfillareaset3data();
  11349.       break;
  11350.  
  11351.     case PTKEINQCOLRMAPFACS: do_pinqcolrmapfacs();
  11352.       break;
  11353.  
  11354.     case PTKEINQCOLRMAPMETHODFACS: do_pinqcolrmapmethodfacs();
  11355.       break;
  11356.  
  11357.     case PTKEINQCOLRMAPREP: do_pinqcolrmaprep();
  11358.       break;
  11359.  
  11360.     case PTKEINQCOLRMAPST: do_pinqcolrmapst();
  11361.       break;
  11362.  
  11363.     case PTKEINQCURVSURFFACS: do_pinqcurvsurffacs();
  11364.       break;
  11365.  
  11366.     case PTKEINQDATAMAPFACS: do_pinqdatamapfacs();
  11367.       break;
  11368.  
  11369.     case PTKEINQDATAMAPREP: do_pinqdatamaprep();
  11370.       break;
  11371.  
  11372.     case PTKEINQDCUEFACS: do_pinqdcuefacs();
  11373.       break;
  11374.  
  11375.     case PTKEINQDCUEREP: do_pinqdcuerep();
  11376.       break;
  11377.  
  11378.     case PTKEINQDIRECTCOLRMODELFACS: do_pinqdirectcolrmodelfacs();
  11379.       break;
  11380.  
  11381.     case PTKEINQDYNSWSATTRSPLUS: do_pinqdynswsattrsplus();
  11382.       break;
  11383.  
  11384.     case PTKEINQEDGEREPPLUS: do_pinqedgerepplus();
  11385.       break;
  11386.  
  11387.     case PTKEINQINTFACSPLUS: do_pinqintfacsplus();
  11388.       break;
  11389.  
  11390.     case PTKEINQINTREPPLUS: do_pinqintrepplus();
  11391.       break;
  11392.  
  11393.     case PTKEINQLIGHTSRCFACS: do_pinqlightsrcfacs();
  11394.       break;
  11395.  
  11396.     case PTKEINQLIGHTSRCREP: do_pinqlightsrcrep();
  11397.       break;
  11398.  
  11399.     case PTKEINQLISTCOLRMAPINDS: do_pinqlistcolrmapinds();
  11400.       break;
  11401.  
  11402.     case PTKEINQLISTDATAMAPINDS: do_pinqlistdatamapinds();
  11403.       break;
  11404.  
  11405.     case PTKEINQLISTDCUEINDS: do_pinqlistdcueinds();
  11406.       break;
  11407.  
  11408.     case PTKEINQLISTLIGHTSRCINDS: do_pinqlistlightsrcinds();
  11409.       break;
  11410.  
  11411.     case PTKEINQLISTPARAMSURFINDS: do_pinqlistparamsurfinds();
  11412.       break;
  11413.  
  11414.     case PTKEINQLISTREFLINDS: do_pinqlistreflinds();
  11415.       break;
  11416.  
  11417.     case PTKEINQPARAMSURFREP: do_pinqparamsurfrep();
  11418.       break;
  11419.  
  11420.     case PTKEINQPATREPPLUS: do_pinqpatrepplus();
  11421.       break;
  11422.  
  11423.     case PTKEINQLINEFACSPLUS: do_pinqlinefacsplus();
  11424.       break;
  11425.  
  11426.     case PTKEINQLINEREPPLUS: do_pinqlinerepplus();
  11427.       break;
  11428.  
  11429.     case PTKEINQMARKERREPPLUS: do_pinqmarkerrepplus();
  11430.       break;
  11431.  
  11432.     case PTKEINQPREDCOLRMAPREP: do_pinqpredcolrmaprep();
  11433.       break;
  11434.  
  11435.     case PTKEINQPREDDATAMAPREP: do_pinqpreddatamaprep();
  11436.       break;
  11437.  
  11438.     case PTKEINQPREDDCUEREP: do_pinqpreddcuerep();
  11439.       break;
  11440.  
  11441.     case PTKEINQPREDEDGEREPPLUS: do_pinqprededgerepplus();
  11442.       break;
  11443.  
  11444.     case PTKEINQPREDINTREPPLUS: do_pinqpredintrepplus();
  11445.       break;
  11446.  
  11447.     case PTKEINQPREDLIGHTSRCREP: do_pinqpredlightsrcrep();
  11448.       break;
  11449.  
  11450.     case PTKEINQPREDPARAMSURFREP: do_pinqpredparamsurfrep();
  11451.       break;
  11452.  
  11453.     case PTKEINQPREDPATREPPLUS: do_pinqpredpatrepplus();
  11454.       break;
  11455.  
  11456.     case PTKEINQPREDLINEREPPLUS: do_pinqpredlinerepplus();
  11457.       break;
  11458.  
  11459.     case PTKEINQPREDMARKERREPPLUS: do_pinqpredmarkerrepplus();
  11460.       break;
  11461.  
  11462.     case PTKEINQPREDREFLREP: do_pinqpredreflrep();
  11463.       break;
  11464.  
  11465.     case PTKEINQPREDTEXTREPPLUS: do_pinqpredtextrepplus();
  11466.       break;
  11467.  
  11468.     case PTKEINQREFLFACS: do_pinqreflfacs();
  11469.       break;
  11470.  
  11471.     case PTKEINQREFLREP: do_pinqreflrep();
  11472.       break;
  11473.  
  11474.     case PTKEINQRENDERINGCOLRMODELFACS: do_pinqrenderingcolrmodelfacs();
  11475.       break;
  11476.  
  11477.     case PTKEINQTEXTREPPLUS: do_pinqtextrepplus();
  11478.       break;
  11479.  
  11480.     case PTKEINQWSSTTABLEPLUS: do_pinqwssttableplus();
  11481.       break;
  11482.  
  11483.     case PTKENUNIBSPLCURV: do_pnunibsplcurv();
  11484.       break;
  11485.  
  11486.     case PTKENUNIBSPLCURVCOLR: do_pnunibsplcurvcolr();
  11487.       break;
  11488.  
  11489.     case PTKENUNIBSPLSURF: do_pnunibsplsurf();
  11490.       break;
  11491.  
  11492.     case PTKENUNIBSPLSURFDATA: do_pnunibsplsurfdata();
  11493.       break;
  11494.  
  11495.     case PTKEPOLYLINESET3DATA: do_ppolylineset3data();
  11496.       break;
  11497.  
  11498.     case PTKEQUADMESH3DATA: do_pquadmesh3data();
  11499.       break;
  11500.  
  11501.     case PTKEQUADMESHDATA: do_pquadmeshdata();
  11502.       break;
  11503.  
  11504.     case PTKESETBACKDATAMAPIND: do_psetbackdatamapind();
  11505.       break;
  11506.  
  11507.     case PTKESETBACKDATAMAPMETH: do_psetbackdatamapmeth();
  11508.       break;
  11509.  
  11510.     case PTKESETBACKINTCOLR: do_psetbackintcolr();
  11511.       break;
  11512.  
  11513.     case PTKESETBACKINTIND: do_psetbackintind();
  11514.       break;
  11515.  
  11516.     case PTKESETBACKINTSHADMETH: do_psetbackintshadmeth();
  11517.       break;
  11518.  
  11519.     case PTKESETBACKINTSTYLE: do_psetbackintstyle();
  11520.       break;
  11521.  
  11522.     case PTKESETBACKINTSTYLEIND: do_psetbackintstyleind();
  11523.       break;
  11524.  
  11525.     case PTKESETBACKREFLIND: do_psetbackreflind();
  11526.       break;
  11527.  
  11528.     case PTKESETBACKREFLMODEL: do_psetbackreflmodel();
  11529.       break;
  11530.  
  11531.     case PTKESETBACKREFLPROPS: do_psetbackreflprops();
  11532.       break;
  11533.  
  11534.     case PTKESETCOLRMAPIND: do_psetcolrmapind();
  11535.       break;
  11536.  
  11537.     case PTKESETCOLRMAPREP: do_psetcolrmaprep();
  11538.       break;
  11539.  
  11540.     case PTKESETCURVAPPROX: do_psetcurvapprox();
  11541.       break;
  11542.  
  11543.     case PTKESETDATAMAPIND: do_psetdatamapind();
  11544.       break;
  11545.  
  11546.     case PTKESETDATAMAPMETH: do_psetdatamapmeth();
  11547.       break;
  11548.  
  11549.     case PTKESETDATAMAPREP: do_psetdatamaprep();
  11550.       break;
  11551.  
  11552.     case PTKESETDCUEIND: do_psetdcueind();
  11553.       break;
  11554.  
  11555.     case PTKESETDCUEREP: do_psetdcuerep();
  11556.       break;
  11557.  
  11558.     case PTKESETEDGECOLR: do_psetedgecolr();
  11559.       break;
  11560.  
  11561.     case PTKESETEDGEREPPLUS: do_psetedgerepplus();
  11562.       break;
  11563.  
  11564.     case PTKESETFACECULLMODE: do_psetfacecullmode();
  11565.       break;
  11566.  
  11567.     case PTKESETFACEDISTINGMODE: do_psetfacedistingmode();
  11568.       break;
  11569.  
  11570.     case PTKESETINTCOLR: do_psetintcolr();
  11571.       break;
  11572.  
  11573.     case PTKESETINTREPPLUS: do_psetintrepplus();
  11574.       break;
  11575.  
  11576.     case PTKESETINTSHADMETH: do_psetintshadmeth();
  11577.       break;
  11578.  
  11579.     case PTKESETLIGHTSRCREP: do_psetlightsrcrep();
  11580.       break;
  11581.  
  11582.     case PTKESETLIGHTSRCSTATE: do_psetlightsrcstate();
  11583.       break;
  11584.  
  11585.     case PTKESETOFFILLAREASETDATA: do_psetoffillareasetdata();
  11586.       break;
  11587.  
  11588.     case PTKESETOFFILLAREASET3DATA: do_psetoffillareaset3data();
  11589.       break;
  11590.  
  11591.     case PTKESETPARAMSURFCHARACS: do_psetparamsurfcharacs();
  11592.       break;
  11593.  
  11594.     case PTKESETPARAMSURFIND: do_psetparamsurfind();
  11595.       break;
  11596.  
  11597.     case PTKESETPARAMSURFREP: do_psetparamsurfrep();
  11598.       break;
  11599.  
  11600.     case PTKESETPATREPPLUS: do_psetpatrepplus();
  11601.       break;
  11602.  
  11603.     case PTKESETLINECOLR: do_psetlinecolr();
  11604.       break;
  11605.  
  11606.     case PTKESETLINEREPPLUS: do_psetlinerepplus();
  11607.       break;
  11608.  
  11609.     case PTKESETLINESHADMETH: do_psetlineshadmeth();
  11610.       break;
  11611.  
  11612.     case PTKESETMARKERCOLR: do_psetmarkercolr();
  11613.       break;
  11614.  
  11615.     case PTKESETMARKERREPPLUS: do_psetmarkerrepplus();
  11616.       break;
  11617.  
  11618.     case PTKESETREFLIND: do_psetreflind();
  11619.       break;
  11620.  
  11621.     case PTKESETREFLMODEL: do_psetreflmodel();
  11622.       break;
  11623.  
  11624.     case PTKESETREFLPROPS: do_psetreflprops();
  11625.       break;
  11626.  
  11627.     case PTKESETREFLREP: do_psetreflrep();
  11628.       break;
  11629.  
  11630.     case PTKESETRENDERINGCOLRMODEL: do_psetrenderingcolrmodel();
  11631.       break;
  11632.  
  11633.     case PTKESETSURFAPPROX: do_psetsurfapprox();
  11634.       break;
  11635.  
  11636.     case PTKESETTEXTCOLR: do_psettextcolr();
  11637.       break;
  11638.  
  11639.     case PTKESETTEXTREPPLUS: do_psettextrepplus();
  11640.       break;
  11641.  
  11642.     case PTKETRISETDATA: do_ptrisetdata();
  11643.       break;
  11644.  
  11645.     case PTKETRISET3DATA: do_ptriset3data();
  11646.       break;
  11647.  
  11648.     case PTKETRISTRIPDATA: do_ptristripdata();
  11649.       break;
  11650.  
  11651.     case PTKETRISTRIP3DATA: do_ptristrip3dat();
  11652.       break;
  11653.  
  11654. #endif
  11655.                   
  11656.     default: phintererror(2, "function unknown.\n", INFORM); 
  11657.              break;
  11658.   }
  11659.   /* finish the line on the output script, if required */
  11660.   if (writingscript)
  11661.     phinprintf(PTKEOUTPUT, "\n");
  11662. }  /* process_phigs_function */
  11663.  
  11664. /*--------------------------------------------------------------------------*/
  11665.  
  11666. static ptkephigsnames look_up_n(C(char *) n)
  11667. PreANSI(char *n)
  11668. /*
  11669. ** description: 
  11670. ** input params: 
  11671. ** output params: 
  11672. ** return value: 
  11673. */
  11674. {
  11675.   /* Searches namelist for the name n.
  11676.     If found in the Phigs list, the index is returned.
  11677.     If not found at all, 0 is returned */
  11678.   Pint i;
  11679.   ptkboolean found;
  11680.  
  11681.   /* first look in the internal namelist */
  11682.   found = FALSE;
  11683.   i = 1;
  11684.   while (!found && i <= MAXPHIGSNAMES) 
  11685.   {
  11686.     if (!strcmp(n, phigsnamelist[i - 1]))
  11687.       found = TRUE;
  11688.     else
  11689.       i++;
  11690.   }
  11691.   if (found)   /* didn't find it in either list */
  11692.     return i;   /* found it in phigs list */
  11693.   else
  11694.     return 0;
  11695. }  /* look_up_n */
  11696.  
  11697. /*--------------------------------------------------------------------------*/
  11698.  
  11699. static void process_comment_line(C(char *) l)
  11700. PreANSI(char *l)
  11701. /*
  11702. ** processes a comment line of the form
  11703. **        ! This is a comment
  11704. ** and writes it to an output script if required.
  11705. */
  11706. {
  11707.   char ch, str[80], *ptr;
  11708.   Pint i;
  11709.   
  11710.   str[0] = '\0';
  11711.   ptr = strchr(l, '\n');
  11712.   if (ptr == NULL)
  11713.     ptr = strchr(l, EOF);
  11714.   if (ptr == NULL)
  11715.   {
  11716.     if (fileswitch)
  11717.     {
  11718.       i = 0;    
  11719.       ch = getc(inputscript);
  11720.       while ((ch != '\n') && (ch != EOF))
  11721.       {
  11722.         str[i] = ch;
  11723.         ch = getc(inputscript);
  11724.         i++;
  11725.       }
  11726.       str[i] = '\0';
  11727.     }
  11728.   }
  11729.   else
  11730.     *ptr = '\0';
  11731.   if (writingscript)
  11732.     phinprintf(PTKEOUTPUT, "%s %s\n", l, str);
  11733. }  /* process_comment_line */
  11734.  
  11735. /*--------------------------------------------------------------------------*/
  11736.  
  11737. static void make_lower_case(C(char *) s)
  11738. PreANSI(char *s)
  11739. /*
  11740. ** description: 
  11741. ** input params: 
  11742. ** output params: 
  11743. ** return value: 
  11744. */
  11745. {
  11746.   /* forces all characters in s to be lower case */
  11747.   Pint i, len;
  11748.  
  11749.   len = strlen(s);
  11750.   for (i = 0; i < len; i++) 
  11751.   {
  11752.     if (isupper(s[i]))
  11753.       s[i] = tolower(s[i]);
  11754.   }
  11755. }  /* make_lower_case */
  11756.  
  11757. /*--------------------------------------------------------------------------*/
  11758.  
  11759. static void interpreter()
  11760. /*
  11761. ** description: There are two drastic exit labels: for faults which require 
  11762. ** that the function finish for good, jump to label 99 at this level.
  11763. ** For other faults which mean 'finish this level of recursion', eg
  11764. ** 'unable to open file', jump to label 90 declared in 'interpreter'. 
  11765. */
  11766. {
  11767.   /* process the script on file 'ifn' */
  11768.   char name[201], errstr[256], defname[255];   /* extracted function name */
  11769.   ptkephigsnames phigsname;   /* the namelist index of a function */
  11770.   ptkboolean quit, process;
  11771.  
  11772.   /* initialisation */
  11773.   quit = FALSE;
  11774.   process = TRUE;
  11775.   lno = 0;   /* initialise the current line number */
  11776.   /* open the input script file */
  11777.  
  11778.   /* loop through the whole file, processing comment lines, null lines
  11779.   ** and function calls 
  11780.   */
  11781.   while (!quit) 
  11782.   {  
  11783.     setjmp(PFABORT);
  11784.     phinteron = FALSE;
  11785.     /* loop */
  11786.     lno++;   /* up current line number */
  11787.     if (readfunction(name)) 
  11788.     {   
  11789.       /* Non-blank line */
  11790.       switch (name[0]) 
  11791.       {
  11792.  
  11793.       case EOF: quit = TRUE;
  11794.                 break;
  11795.  
  11796.       case '!': process_comment_line(name);
  11797.                   break;
  11798.  
  11799.       case 'q': make_lower_case(name);
  11800.                 if (strcmp(name, "quit") == 0)
  11801.                 { 
  11802.                   quit = TRUE;
  11803.                   if (writingscript)
  11804.                     phinprintf(PTKEOUTPUT, "quit\n");
  11805.                   break;
  11806.                 }
  11807.  
  11808.       case 'e': make_lower_case(name);
  11809.                 if (strcmp(name, "exit") == 0)
  11810.                 { 
  11811.                   quit = TRUE;
  11812.                   if (writingscript)
  11813.                     phinprintf(PTKEOUTPUT, "quit\n");
  11814.                   break;
  11815.                 }
  11816.  
  11817.       case 'h': make_lower_case(name);
  11818.                 if (strcmp(name, "help") == 0)
  11819.                 { 
  11820.                   phinprintf(PTKEINFORM, "This is Phinter, the PHIGS textual interpreter of the PHIGS Toolkit.\n");
  11821.                   phinprintf(PTKEINFORM, "Input a PHIGS function name or quit/exit to leave Phinter.\n");
  11822.                   phinprintf(PTKEINFORM, "Enter ABORT to jump out of a PHIGS function call.\n");
  11823.                   phinprintf(PTKEINFORM, "Consult the PHIGS Toolkit User Guide for a complete list of PHIGS\nfunctions and enumerated types.\n");
  11824.                   break;
  11825.                 }
  11826.  
  11827.       case '#': make_lower_case(name);
  11828.                 if ((strcmp(name, "#if") == 0) || 
  11829.                     (strcmp(name, "#ifdef") == 0))
  11830.         {
  11831.                   readstring(defname, "macro name");
  11832.                   if (strcmp(defname, "SUN") == 0)
  11833. #ifdef SUN
  11834.                     process = TRUE;
  11835. #endif                             
  11836. #ifdef VMS
  11837.                     process = FALSE;
  11838. #endif                             
  11839. #ifdef HP
  11840.                     process = FALSE;
  11841. #endif                             
  11842. #ifdef PEXSI
  11843.                     process = FALSE;
  11844. #endif                             
  11845.                   else
  11846.                   if (strcmp(defname, "VMS") == 0)
  11847. #ifdef VMS
  11848.                     process = TRUE;
  11849. #endif                             
  11850. #ifdef SUN
  11851.                     process = FALSE;
  11852. #endif                             
  11853. #ifdef HP
  11854.                     process = FALSE;
  11855. #endif      
  11856. #ifdef PEXSI
  11857.                     process = FALSE;
  11858. #endif                                                    
  11859.                   else
  11860.                   if (strcmp(defname, "HP") == 0)
  11861. #ifdef HP
  11862.                     process = TRUE;
  11863. #endif                             
  11864. #ifdef SUN
  11865.                     process = FALSE;
  11866. #endif                             
  11867. #ifdef VMS
  11868.                     process = FALSE;
  11869. #endif      
  11870. #ifdef PEXSI
  11871.                     process = FALSE;
  11872. #endif                                                    
  11873.                   else
  11874.                   if (strcmp(defname, "PEXSI") == 0)
  11875. #ifdef PEXSI
  11876.                     process = TRUE;
  11877. #endif                             
  11878. #ifdef SUN
  11879.                     process = FALSE;
  11880. #endif                             
  11881. #ifdef VMS
  11882.                     process = FALSE;
  11883. #endif      
  11884. #ifdef HP
  11885.                     process = FALSE;
  11886. #endif                                                    
  11887.                   break;
  11888.                 }
  11889.                 else
  11890.                 if (strcmp(name, "#endif") == 0)
  11891.         {
  11892.                   process = TRUE;  
  11893.                   break;
  11894.                 }                
  11895.  
  11896.       default:   /* looks like a function call */
  11897.                  /* now look it up */
  11898.                  if (process)
  11899.          {
  11900.                    phinteron = TRUE;
  11901.                    make_lower_case(name);
  11902.                    if (substrinlist(phigsnamelist, MAXPHIGSNAMES, name, 
  11903.                        &phigsname))
  11904.                      process_phigs_function(phigsname);
  11905.                    else 
  11906.                    {
  11907.                      /* unknown function */
  11908.                      sprintf(errstr, "ignoring unknown function, %s.\n", 
  11909.                              name); 
  11910.                      phintererror(2, errstr, INFORM);
  11911.                    }
  11912.                  }
  11913.                  break;
  11914.       }
  11915.     }  /* readword test */
  11916.     if (!interactive)
  11917.       if (feof(inputscript))
  11918.         quit = TRUE;
  11919.   }  /* loop */
  11920.   setjmp(POPJMP);
  11921. }  /* interpreter */
  11922.  
  11923. /*--------------------------------------------------------------------------*/
  11924.  
  11925. static void sayhello()
  11926. {
  11927.   phinprintf(PTKESTDOUT, "This is phinter, version %.1f%s\n", 
  11928.             (Pfloat)CURRENTVERSION, phintermessage);
  11929. }  /* sayhello */
  11930.  
  11931. /*--------------------------------------------------------------------------*/
  11932.  
  11933. /*function:external*/
  11934. extern void ptk_phinter(C(FILE *) input, C(FILE *) output, C(FILE *) inform)
  11935. PreANSI(FILE *input)
  11936. PreANSI(FILE *output)
  11937. PreANSI(FILE *inform)
  11938. /*
  11939. ** \parambegin
  11940. ** \param{FILE *}{input}{file pointer for input script}{IN}
  11941. ** \param{FILE *}{output}{file pointer for output script}{OUT}
  11942. ** \param{FILE *}{inform}{file pointer for information such as results of
  11943. ** inquiry calls.}{OUT}
  11944. ** \paramend
  11945. ** \blurb{This function reads a PHIGS script from a file or from standard
  11946. ** input. If {\tt stdin} is passed as the input file pointer then
  11947. ** phinter becomes interactive and prompts are given for function
  11948. ** parameters. The other file pointers are used for writing an output 
  11949. ** script and for writing data which
  11950. ** results from inquiry calls and so on.}
  11951. */
  11952. {
  11953.   fileswitch = TRUE;
  11954.   inputscript = input;
  11955.   if (input == stdin)
  11956.     interactive = TRUE;
  11957.   else
  11958.     interactive = FALSE;
  11959.   outputscript = output;
  11960.   if (output == NULL)
  11961.     writingscript = FALSE;   
  11962.   else
  11963.     writingscript = TRUE;   
  11964.   informscript = inform;
  11965.   if (inform == NULL)
  11966.     writeinform = FALSE;   
  11967.   else
  11968.     writeinform = TRUE;    
  11969.   sayhello();
  11970.   interpreter();
  11971.   setjmp(EXITJMP);
  11972. }  /* ptk_phinter */
  11973.  
  11974. /*-------------------------------------------------------------------------*/
  11975.  
  11976. /*function:external*/
  11977. extern void ptk_strphinter(C(Pint) wsid, C(Plimit *) echoarea, 
  11978.                            C(Pint) outputterminal, C(Pint) informterminal)
  11979. PreANSI(Pint wsid)
  11980. PreANSI(Plimit *echoarea)
  11981. PreANSI(Pint outputterminal)
  11982. PreANSI(Pint informterminal)
  11983. /*
  11984. ** \parambegin
  11985. ** \param{Pint}{wsid}{workstation identifier}{IN}
  11986. ** \param{Plimit *}{echo area}{echo area for string device}{IN}
  11987. ** \param{Pint}{outputterminal}{terminal window identifier for writing
  11988. ** output script to}{IN}
  11989. ** \param{Pint}{informterminal}{terminal window identifier for writing
  11990. ** information data}{IN}
  11991. ** \paramend
  11992. ** \blurb{This function redirects the input of phinter to the PHIGS string 
  11993. ** device (number 1). Strphinter is always interactive and output is directed
  11994. ** to terminal windows instead of files so that it may be displayed in the
  11995. ** PHIGS workstation window.}
  11996. */
  11997. {
  11998.   ptkewindowtype type;
  11999.   Pint err;
  12000.  
  12001.   fileswitch = FALSE;
  12002.   phinws = wsid;
  12003.   phinecho = *echoarea;
  12004.   outputterm = outputterminal;
  12005.   informterm = informterminal;
  12006.   interactive = TRUE;
  12007.   ptk_inqwindowtype(outputterm, &type, &err);
  12008.   if (type == PTKETERMINALWINDOW)
  12009.     writingscript = TRUE;   
  12010.   else
  12011.     writingscript = FALSE;   
  12012.   ptk_inqwindowtype(informterm, &type, &err);
  12013.   if (type == PTKETERMINALWINDOW)
  12014.     writeinform = TRUE;   
  12015.   else
  12016.     writeinform = FALSE;   
  12017.   sayhello();
  12018.   interpreter();
  12019.   setjmp(EXITJMP);
  12020. }  /* ptk_strphinter */
  12021.  
  12022. /*-------------------------------------------------------------------------*/
  12023.  
  12024. static void writestruct(C(FILE *) fileptr, C(Pint) stid)
  12025. PreANSI(FILE *fileptr)
  12026. PreANSI(Pint stid)
  12027. {
  12028.   Pint numelems, i, err, size;
  12029.   char str[100];
  12030.   ptkselcontent elcont;
  12031.   Pstore store;
  12032.  
  12033.   fileswitch = TRUE;
  12034.   outputscript = fileptr;
  12035.   numelems = ptk_elemcount(stid);
  12036.   fprintf(fileptr, "open_structure ");
  12037.   if (ptk_hashtableused("structureid"))
  12038.   {
  12039.     ptk_inttostring("structureid", stid, 100, str, &size);
  12040.     if (size > 0)
  12041.       fprintf(fileptr,"\"%s\"\n", str);
  12042.     else
  12043.       fprintf(fileptr, "%d\n", stid);
  12044.   }
  12045.   else
  12046.     fprintf(fileptr, "%d\n", stid);
  12047.   for (i = 1; i <= numelems; i++)
  12048.   {
  12049.     pcreate_store(&err, &store);
  12050.     ptk_inqelemtypesizecontent(stid, i, store, &err, &elcont);
  12051.     writeelemcontent(PTKEOUTPUT, &elcont);
  12052.     ptk_delstore(store);
  12053.   }  
  12054.   fprintf(fileptr, "close_structure");
  12055. }  /* writestruct */
  12056.  
  12057. /*--------------------------------------------------------------------------*/
  12058.  
  12059. static void writestructnet(C(FILE *) fileptr, C(Pint) stid)
  12060. PreANSI(FILE *fileptr)
  12061. PreANSI(Pint stid)
  12062. {
  12063.   Pint_list stnetids;
  12064.   Pint i, totsize;
  12065.  
  12066.   ptk_inqstructnetids(stid, 0, &stnetids, &totsize);
  12067.   stnetids.ints = (Pint *)calloc(totsize, sizeof(Pint));
  12068.   ptk_inqstructnetids(stid, totsize, &stnetids, &totsize);  
  12069.   for (i = 0; i < stnetids.num_ints; i++)
  12070.   {
  12071.     writestruct(fileptr, stnetids.ints[i]);
  12072.     fprintf(fileptr, "\n\n");
  12073.   }
  12074. }  /* writestructnet */
  12075.  
  12076. /*--------------------------------------------------------------------------*/
  12077.  
  12078. /*function:external*/
  12079. extern ptkboolean ptk_readphinterscript(C(char *) scriptname, C(FILE *) output, 
  12080.                                      C(FILE *) inform)
  12081. PreANSI(char *scriptname)
  12082. PreANSI(FILE *output)
  12083. PreANSI(FILE *inform)
  12084. /*
  12085. ** \parambegin
  12086. ** \param{char *}{scriptname}{script filename}{IN}
  12087. ** \param{FILE *}{output}{output script file pointer}{OUT}
  12088. ** \param{FILE *}{inform}{information script file pointer}{OUT}
  12089. ** \paramend
  12090. ** \blurb{This function reads a PHIGS script from the file specified
  12091. ** by {\tt scriptname}. The file is automatically opened and closed
  12092. ** and the function returns TRUE if a PHIGS script has been successfully 
  12093. ** read.}
  12094. */
  12095. {
  12096.   FILE *inputfile;
  12097.  
  12098.   inputfile = fopen(scriptname, "r");
  12099.   if (inputfile == NULL)
  12100.     return FALSE;
  12101.   rewind(inputfile);
  12102.   ptk_phinter(inputfile, output, inform);
  12103.   fclose(inputfile);
  12104.   return TRUE;  
  12105. }  /* ptk_readphinterscript */
  12106.  
  12107. /*--------------------------------------------------------------------------*/
  12108.  
  12109. /*function:external*/
  12110. extern void ptk_writestruct(C(FILE *) fileptr, C(Pint_list *) stids)
  12111. PreANSI(FILE *fileptr)
  12112. PreANSI(Pint_list *stids)
  12113. /*
  12114. ** \parambegin
  12115. ** \param{FILE *}{fileptr}{pointer to file}{OUT}
  12116. ** \param{Pint\_list *}{stids}{structure identifier list}{IN}
  12117. ** \paramend
  12118. ** \blurb{This function writes the contents of a list of structures 
  12119. ** to a file. The structures are written in the PHIGS script format so that
  12120. ** they may be read in again using {\tt ptk\_phinter}.}
  12121. */
  12122. {
  12123.   Pint i;
  12124.  
  12125.   if (fileptr != NULL)
  12126.   {
  12127.     for (i = 0; i < stids->num_ints; i++)
  12128.     {
  12129.       writestruct(fileptr, stids->ints[i]);
  12130.       fprintf(fileptr, "\n\n");
  12131.     }
  12132.   }
  12133. }  /* ptk_writestruct */
  12134.  
  12135. /*--------------------------------------------------------------------------*/
  12136.  
  12137. /*function:external*/
  12138. extern void ptk_writestructnet(C(FILE *) fileptr, C(Pint_list *) stids)
  12139. PreANSI(FILE *fileptr)
  12140. PreANSI(Pint_list *stids)
  12141. /*
  12142. ** \parambegin
  12143. ** \param{FILE *}{fileptr}{pointer to file}{OUT}
  12144. ** \param{Pint\_list *}{stids}{structure network identifier list}{IN}
  12145. ** \paramend
  12146. ** \blurb{This function writes the contents of a list of structure networks 
  12147. ** to a file. The structures are written in the PHIGS script format so that
  12148. ** they may be read in again using {\tt ptk\_phinter}.}
  12149. */
  12150. {
  12151.   Pint i;
  12152.  
  12153.   if (fileptr != NULL)
  12154.   {
  12155.     for (i = 0; i < stids->num_ints; i++)
  12156.     {
  12157.       writestructnet(fileptr, stids->ints[i]);
  12158.       fprintf(fileptr, "\n\n");
  12159.     }
  12160.   }
  12161. }  /* ptk_writestructnet */
  12162.  
  12163. /*--------------------------------------------------------------------------*/
  12164.  
  12165. /*function:external*/
  12166. extern void ptk_writeallstruct(C(FILE *) fileptr)
  12167. PreANSI(FILE *fileptr)
  12168. /*
  12169. ** \parambegin
  12170. ** \param{FILE *}{fileptr}{pointer to file}{OUT}
  12171. ** \paramend
  12172. ** \blurb{This function writes the contents of all the structures in the
  12173. ** PHIGS CSS to a file. The structures are written in the PHIGS script 
  12174. ** format so that they may be read in again using {\tt ptk\_phinter}.}
  12175. */
  12176. {
  12177.   Pint err, totlength, i;
  12178.   Pint_list stids;
  12179.  
  12180.   if (fileptr != NULL)
  12181.   {
  12182.     pinq_struct_ids(0, 0, &err, &stids, &totlength);
  12183.     stids.ints = (Pint *)calloc(totlength, sizeof(Pint));
  12184.     stids.num_ints = totlength;
  12185.     pinq_struct_ids(totlength, 0, &err, &stids, &totlength);
  12186.     for (i = 0; i < stids.num_ints; i++)
  12187.     {
  12188.       writestruct(fileptr, stids.ints[i]);
  12189.       fprintf(fileptr, "\n\n");
  12190.     }
  12191.     free(stids.ints);  
  12192.   }
  12193. }  /* ptk_writeallstruct */
  12194.  
  12195. /*--------------------------------------------------------------------------*/
  12196.  
  12197. /*function:external*/
  12198. extern void ptk_readelem(C(Pint) ws, C(Plimit *) echoarea, C(Pelem_type) eltype)
  12199. PreANSI(Pint ws)
  12200. PreANSI(Plimit *echoarea)
  12201. PreANSI(Pelem_type eltype)
  12202. /*
  12203. ** \parambegin
  12204. ** \param{Pint}{wsid}{workstation identifier}{IN}
  12205. ** \param{Plimit *}{echo area}{echo area for string device}{IN}
  12206. ** \param{Pelem\_type}{eltype}{element type to read in}{IN}
  12207. ** \paramend
  12208. ** \blurb{This function reads the contents of a PHIGS element from the 
  12209. ** PHIGS string device (number 1). Prompts are given for the required data
  12210. ** depending on the element type. An element with the input data is inserted
  12211. ** into the currently open structure at the current editing position.}
  12212. */
  12213. {
  12214.   fileswitch = FALSE;
  12215.   phinws = ws;
  12216.   phinecho = *echoarea;
  12217.   writingscript = FALSE;
  12218.   writeinform = FALSE;
  12219.   switch (eltype)
  12220.   {
  12221.     case PELEM_NIL:
  12222.       break;
  12223.  
  12224.     case PELEM_POLYLINE3: do_ppolyline3();
  12225.       break;
  12226.  
  12227.     case PELEM_POLYMARKER3: do_ppolymarker3();
  12228.       break;
  12229.  
  12230.     case PELEM_FILL_AREA3: do_pfillarea3();
  12231.       break;
  12232.  
  12233.     case PELEM_POLYLINE: do_ppolyline();
  12234.       break;
  12235.  
  12236.     case PELEM_POLYMARKER: do_ppolymarker();
  12237.       break;
  12238.  
  12239.     case PELEM_FILL_AREA: do_pfillarea();
  12240.     break;
  12241.  
  12242.     case PELEM_TEXT3: do_ptext3();
  12243.     break;
  12244.  
  12245.     case PELEM_TEXT: do_ptext();
  12246.     break;
  12247.  
  12248.     case PELEM_ANNO_TEXT_REL3: do_pannotationtextrelative3();
  12249.     break;
  12250.  
  12251.     case PELEM_ANNO_TEXT_REL: do_pannotationtextrelative();
  12252.     break;
  12253.  
  12254.     case PELEM_FILL_AREA_SET3: do_pfillareaset3();
  12255.     break;
  12256.  
  12257.     case PELEM_FILL_AREA_SET: do_pfillareaset();
  12258.     break;
  12259.  
  12260.     case PELEM_CELL_ARRAY3: do_pcellarray3();
  12261.     break;
  12262.  
  12263.     case PELEM_CELL_ARRAY: do_pcellarray();
  12264.     break;
  12265.  
  12266.     case PELEM_GDP3: do_pgdp3();
  12267.     break;
  12268.  
  12269.     case PELEM_GDP: do_pgdp();
  12270.     break;
  12271.  
  12272.     case PELEM_LINE_IND: do_psetlineind();
  12273.       break;
  12274.  
  12275.     case PELEM_MARKER_IND: do_psetmarkerind();
  12276.       break;
  12277.  
  12278.     case PELEM_TEXT_IND: do_psettextind();
  12279.       break;
  12280.  
  12281.     case PELEM_INT_IND: do_psetintind();
  12282.       break;
  12283.  
  12284.     case PELEM_EDGE_IND: do_psetedgeind();
  12285.       break;
  12286.  
  12287.     case PELEM_LINETYPE: do_psetlinetype();
  12288.       break;
  12289.  
  12290.     case PELEM_LINE_COLR_IND: do_psetlinecolourind();
  12291.       break;
  12292.  
  12293.     case PELEM_MARKER_TYPE: do_psetmarkertype();
  12294.       break;
  12295.  
  12296.     case PELEM_MARKER_COLR_IND: do_psetmarkercolourind();
  12297.       break;
  12298.  
  12299.     case PELEM_TEXT_FONT: do_psettextfont();
  12300.       break;
  12301.  
  12302.     case PELEM_TEXT_COLR_IND: do_psettextcolourind();
  12303.       break;
  12304.  
  12305.     case PELEM_ANNO_STYLE: do_psetannotationstyle();
  12306.       break;
  12307.  
  12308.     case PELEM_INT_STYLE_IND: do_psetintstyleind();
  12309.       break;
  12310.  
  12311.     case PELEM_INT_COLR_IND: do_psetintcolourind();
  12312.       break;
  12313.  
  12314.     case PELEM_EDGETYPE: do_psetedgetype();
  12315.       break;
  12316.  
  12317.     case PELEM_EDGE_COLR_IND: do_psetedgecolourind();
  12318.       break;
  12319.  
  12320.     case PELEM_HLHSR_ID: do_psethlhsrid();
  12321.       break;
  12322.  
  12323.     case PELEM_VIEW_IND: do_psetviewind();
  12324.       break;
  12325.  
  12326.     case PELEM_LABEL: do_plabel();
  12327.       break;
  12328.  
  12329.     case PELEM_PICK_ID: do_psetpickid();
  12330.     break;
  12331.  
  12332.     case PELEM_LINEWIDTH: do_psetlinewidth();
  12333.       break;
  12334.  
  12335.     case PELEM_MARKER_SIZE: do_psetmarkersize();
  12336.       break;
  12337.  
  12338.     case PELEM_CHAR_EXPAN: do_psetcharexpan();
  12339.       break;
  12340.  
  12341.     case PELEM_CHAR_SPACE: do_psetcharspace();
  12342.       break;
  12343.  
  12344.     case PELEM_CHAR_HT: do_psetcharheight();
  12345.       break;
  12346.  
  12347.     case PELEM_ANNO_CHAR_HT: do_psetannotationcharheight();
  12348.       break;
  12349.  
  12350.     case PELEM_EDGEWIDTH: do_psetedgewidth();
  12351.     break;
  12352.  
  12353.     case PELEM_EXEC_STRUCT: do_pexecutestruct();
  12354.       break;
  12355.   
  12356.     case PELEM_TEXT_PREC: do_psettextprec();
  12357.     break;
  12358.  
  12359.     case PELEM_CHAR_UP_VEC: do_psetcharup();
  12360.       break;
  12361.  
  12362.     case PELEM_ANNO_CHAR_UP_VEC: do_psetannotationcharup();
  12363.     break;
  12364.  
  12365.     case PELEM_TEXT_PATH: do_psettextpath();
  12366.       break;
  12367.  
  12368.     case PELEM_ANNO_PATH: do_psetannotationpath();
  12369.     break;
  12370.  
  12371.     case PELEM_TEXT_ALIGN: do_psettextalign();
  12372.       break;
  12373.  
  12374.     case PELEM_ANNO_ALIGN: do_psetannotationalign();
  12375.     break;
  12376.  
  12377.     case PELEM_INT_STYLE: do_psetintstyle();
  12378.     break;
  12379.  
  12380.     case PELEM_EDGE_FLAG: do_psetedgeflag();
  12381.     break;
  12382.  
  12383.     case PELEM_PAT_SIZE: do_psetpatsize();
  12384.       break;
  12385.  
  12386.     case PELEM_PAT_REF_POINT: do_psetpatrefpt();
  12387.     break;
  12388.  
  12389.     case PELEM_PAT_REF_POINT_VECS: do_psetpatrefptvectors();
  12390.     break;
  12391.  
  12392.     case PELEM_ADD_NAMES_SET: do_paddnameset();
  12393.       break;
  12394.  
  12395.     case PELEM_REMOVE_NAMES_SET: do_premovenameset();
  12396.     break;
  12397.  
  12398.     case PELEM_INDIV_ASF: do_psetindivasf();
  12399.     break;
  12400.  
  12401.     case PELEM_LOCAL_MODEL_TRAN3: do_psetlocaltran3();
  12402.     break;
  12403.  
  12404.     case PELEM_LOCAL_MODEL_TRAN: do_psetlocaltran();
  12405.     break;
  12406.  
  12407.     case PELEM_GLOBAL_MODEL_TRAN3: do_psetglobaltran3();
  12408.     break;
  12409.  
  12410.     case PELEM_GLOBAL_MODEL_TRAN: do_psetglobaltran();
  12411.     break;
  12412.  
  12413.     case PELEM_MODEL_CLIP_VOL3: do_psetmodelclipvolume3();
  12414.     break;
  12415.  
  12416.     case PELEM_MODEL_CLIP_VOL: do_psetmodelclipvolume();
  12417.     break;
  12418.  
  12419.     case PELEM_MODEL_CLIP_IND: do_psetmodelclipindicator();
  12420.     break;
  12421.  
  12422.     case PELEM_RESTORE_MODEL_CLIP_VOL: do_prestoremodelclipvolume();
  12423.     break;
  12424.  
  12425.     case PELEM_APPL_DATA: do_papplicationdata();
  12426.     break;
  12427.  
  12428.     case PELEM_GSE: do_pgse();
  12429.     break;
  12430.  
  12431.   }
  12432. }  /* ptk_readelem */
  12433.  
  12434. /*--------------------------------------------------------------------------*/
  12435.  
  12436. static void read_string(C(char *) str)
  12437. PreANSI(char *str)
  12438. /*
  12439. ** description: 
  12440. ** input params: 
  12441. ** output params: 
  12442. ** return value: 
  12443. */
  12444. {
  12445.   /* Reads a string. if the first non-blank character found is
  12446.      a double quote ("), the string is assumed to quoted, and must
  12447.      be "string", on one line. otherwise, the next sequence of
  12448.      non-blank characters will be returned as the string */
  12449.   Pint wi;
  12450.   Pint ch;
  12451.   ptkboolean finished;
  12452.  
  12453.   wi = 0;
  12454.   finished = FALSE;
  12455.   ch =  getc(stdin);
  12456.   while (ch == ' ' || ch == '\n')
  12457.     ch = getc(stdin);
  12458.   while (!finished)
  12459.   {
  12460.     str[wi] = ch;
  12461.     wi++;
  12462.     if (ch == '\0')
  12463.       finished = TRUE;
  12464.     else
  12465.     if (ch == '\n' || ch == ' ')
  12466.     {
  12467.       finished = TRUE;
  12468.       wi--;
  12469.     }
  12470.     else
  12471.       ch = getc(stdin);
  12472.   }
  12473.   str[wi] = '\0';
  12474. }  /* read_string */
  12475.  
  12476. /*--------------------------------------------------------------------------*/
  12477.  
  12478. /*function:external*/
  12479. extern void ptk_callphinter(C(void))
  12480. /*PreANSI()*/
  12481. /*
  12482. ** \blurb{This function provides an interface to phinter and its related
  12483. ** functions. The available commands are as follows:
  12484. ** \begin{description}
  12485. ** \item[help]{output this list.}
  12486. ** \item[interactive]{call phinter with stdin for input script.}
  12487. ** \item[stringinput]{call phinter using string device for input 
  12488. ** and terminal windows for output.}
  12489. ** \item[read]{call phinter with a given input script.}
  12490. ** \item[outputfile]{set output script filename.}
  12491. ** \item[informfile]{set information filename.}
  12492. ** \item[outputterm]{set output terminal window identifier.}
  12493. ** \item[informterm]{set information terminal window identifier.}
  12494. ** \item[writestruct]{write contents of structures to output file.}
  12495. ** \item[writestruct]{write contents of structure networks
  12496. ** to output file.}
  12497. ** \item[writestruct]{write contents of all structures to
  12498. ** output file.}
  12499. ** \item[quit or exit]{leave callphinter.}
  12500. ** \end{description}\ 
  12501. ** }
  12502. */
  12503. {
  12504.   FILE *f, *inf, *outf;
  12505.   Pint lencom;
  12506.   ptkboolean finished;
  12507.   char filename[255], command[30];
  12508.   Pint outterm, infterm;
  12509.  
  12510.   fileswitch = TRUE;
  12511.   finished = FALSE;
  12512.   inf = stdout;
  12513.   outf = NULL;
  12514.   while (!finished)
  12515.   {
  12516.     inputscript = stdin;
  12517.     interactive = TRUE;
  12518.     printf("callphinter> ");
  12519.     read_string(command);
  12520.     lencom = strlen(command);
  12521.     if (strncmp(command, "help", lencom) == 0)
  12522.     {
  12523.       printf("commands\n--------\n");
  12524.       printf("help -- output this list.\n");
  12525.       printf("interactive -- call phinter with stdin for input script.\n");
  12526.       printf("stringinput -- call phinter using string device for input\n");
  12527.       printf("               and terminal windows for output.\n");
  12528.       printf("read -- call phinter with a given input script.\n");
  12529.       printf("outputfile -- set output script filename.\n");
  12530.       printf("informfile -- set information filename.\n");
  12531.       printf("outputterm -- set output terminal window identifier.\n");
  12532.       printf("informterm -- set information terminal window identifier.\n");
  12533.       printf("writestruct -- write contents of structures to output file.\n");
  12534.       printf("writestructnet -- write contents of structure networks\n");
  12535.       printf("               to output file.\n");
  12536.       printf("writeallstruct -- write contents of all structures to \n");
  12537.       printf("               output file.\n");
  12538.       printf("quit or exit -- leave callphinter.\n");
  12539.     }
  12540.     else
  12541.     if (strncmp(command, "interactive", lencom) == 0)
  12542.     {
  12543.       ptk_phinter(stdin, outf, inf);
  12544.     }
  12545.     else
  12546.     if (strncmp(command, "phigs", lencom) == 0)
  12547.     {
  12548.       ptk_phinter(stdin, outf, inf);
  12549.     }
  12550.     else
  12551.     if (strncmp(command, "stringinput", lencom) == 0)
  12552.     {
  12553.       Pint ws;
  12554.       Plimit echoarea;
  12555.  
  12556.       ws = readinteger("workstation identifier");
  12557.       echoarea = readlimit("echo area");
  12558.       ptk_strphinter(ws, &echoarea, outterm, infterm);
  12559.       fileswitch = TRUE;
  12560.     }
  12561.     else
  12562.     if (strncmp(command, "read", lencom) == 0)
  12563.     {
  12564.       printf("filename > ");
  12565.       read_string(filename);
  12566.       stripstr(filename, '"');
  12567.       f = fopen(filename, "r");
  12568.       if (f == NULL)
  12569.       {
  12570.         printf("couldn't find file %s\n", filename);
  12571.       }
  12572.       else
  12573.       {
  12574.         rewind(f);
  12575.         ptk_phinter(f, outf, inf);
  12576.         fclose(f);
  12577.       }
  12578.     }
  12579.     else
  12580.     if (strncmp(command, "informfile", lencom) == 0)
  12581.     {
  12582.       FILE *tempf;
  12583.  
  12584.       printf("information filename > ");
  12585.       read_string(filename);
  12586.       stripstr(filename, '"');
  12587.       if (strncmp(filename, "stdout", 6) == 0)
  12588.       {
  12589.         if (inf != stdout)
  12590.           fclose(inf);
  12591.         inf = stdout;        
  12592.       }
  12593.       else
  12594.       if (strncmp(filename, "NULL", 4) == 0)
  12595.       {
  12596.         if ((inf != stdout) && (inf != NULL))
  12597.           fclose(inf);
  12598.         inf = (FILE *)NULL;
  12599.       }
  12600.       else
  12601.       {
  12602.         tempf = fopen(filename, "w+");
  12603.         if (tempf == NULL)
  12604.     {
  12605.           printf("couldn't find file %s\n", filename);
  12606.         }
  12607.         else
  12608.     {
  12609.           if (inf != stdout)
  12610.             fclose(inf);
  12611.           inf = tempf;
  12612.         }
  12613.       }
  12614.     }
  12615.     else
  12616.     if (strncmp(command, "outputfile", lencom) == 0)
  12617.     {
  12618.       FILE *tempf;
  12619.  
  12620.       printf("output script filename > ");
  12621.       read_string(filename);
  12622.       stripstr(filename, '"');
  12623.       if (strncmp(filename, "stdout", 6) == 0)
  12624.       {
  12625.         if (outf != stdout)
  12626.           fclose(outf);
  12627.         outf = stdout;        
  12628.       }
  12629.       else
  12630.       if (strncmp(filename, "NULL", 4) == 0)
  12631.       {
  12632.         if ((outf != stdout) && (outf != NULL))
  12633.           fclose(outf);
  12634.         outf = (FILE *)NULL;
  12635.       }
  12636.       else
  12637.       {
  12638.         tempf = fopen(filename, "w+");
  12639.         if (tempf == NULL)
  12640.     {
  12641.           printf("couldn't find file %s\n", filename);
  12642.         }
  12643.         else
  12644.     {
  12645.           if (outf != stdout)
  12646.             fclose(outf);
  12647.           outf = tempf;
  12648.         }
  12649.       }
  12650.     }
  12651.     else
  12652.     if (strncmp(command, "outputterm", lencom) == 0)
  12653.     {
  12654.       outterm = readinteger("output script terminal window identifier");
  12655.     }
  12656.     else
  12657.     if (strncmp(command, "informterm", lencom) == 0)
  12658.     {
  12659.       infterm = readinteger("information terminal window identifier");
  12660.     }
  12661.     else
  12662.     if (strncmp(command, "writestruct", lencom) == 0)
  12663.     {
  12664.       Pint i;
  12665.       Pint_list stids;
  12666.  
  12667.       stids.num_ints = readposinteger("number of structures");
  12668.       stids.ints = (Pint *)calloc(stids.num_ints, sizeof(Pint));
  12669.       for (i = 0; i < stids.num_ints; i++)
  12670.         stids.ints[i] = readintvalue("structure identifier", PTKESTRUCTID);
  12671.       printf("writing structures...\n");
  12672.       ptk_writestruct(outf, &stids);
  12673.       free(stids.ints);
  12674.     }
  12675.     else
  12676.     if (strncmp(command, "writestructnet", lencom) == 0)
  12677.     {
  12678.       Pint i;
  12679.       Pint_list stids;
  12680.  
  12681.       stids.num_ints = readposinteger("number of structure networks");
  12682.       stids.ints = (Pint *)calloc(stids.num_ints, sizeof(Pint));
  12683.       for (i = 0; i < stids.num_ints; i++)
  12684.         stids.ints[i] = readintvalue("root structure identifier", 
  12685.                                      PTKESTRUCTID);
  12686.       printf("writing structure networks...\n");
  12687.       ptk_writestructnet(outf, &stids);
  12688.       free(stids.ints);
  12689.     }
  12690.     else
  12691.     if (strncmp(command, "writeallstruct", lencom) == 0)
  12692.     {
  12693.       printf("writing all structures...\n");
  12694.       ptk_writeallstruct(outf);
  12695.     }
  12696.     else
  12697.     if ((strncmp(command, "quit", lencom) == 0) ||
  12698.         (strncmp(command, "exit", lencom) == 0))
  12699.     {
  12700.       finished = TRUE;
  12701.     }
  12702.     else
  12703.       printf("Callphinter: command unknown.\n");
  12704.   }
  12705.   if (inf != stdout)
  12706.     fclose(inf);
  12707.   if (outf != stdout)
  12708.     fclose(outf);
  12709. }  /* ptk_callphinter */
  12710.  
  12711. /*--------------------------------------------------------------------------*/
  12712.  
  12713. /*function:external*/
  12714. extern ptkboolean ptk_elemcontent(C(Pint) stid, C(Pint) elemid, C(Pint) termid,
  12715.                                C(Pint *) error)
  12716. PreANSI(Pint stid)
  12717. PreANSI(Pint elemid)
  12718. PreANSI(Pint termid)
  12719. PreANSI(Pint *error)
  12720. /* 
  12721. ** \parambegin
  12722. ** \param{Pint}{stid}{structure identifier}{IN}
  12723. ** \param{Pint}{elemid}{element number}{IN}
  12724. ** \param{Pint}{termid}{terminal window identifier}{IN}
  12725. ** \param{PInt *}{error}{error code}{OUT}
  12726. ** \paramend
  12727. ** \blurb{This function writes the contents of an element in a 
  12728. ** terminal window. If the element is an output primitive then
  12729. ** it is inserted into the currently open structure at the current
  12730. ** editing position and the function returns TRUE, otherwise FALSE.}
  12731. */
  12732. {
  12733.   Pint ecount, namelen, i, numpts, err, name;
  12734.   ptkselcontent elcont;
  12735.   Pstruct_status stat;
  12736.   char elemname[50];
  12737.   ptkboolean inserted;
  12738.   Popen_struct_status structst;
  12739.   Pstore store;
  12740.  
  12741.   fileswitch = FALSE;
  12742.   outputterm = termid;
  12743.   writingscript = FALSE;
  12744.   writeinform = FALSE;
  12745.   *error = 0;
  12746.   inserted = FALSE;
  12747.   pinq_struct_status(stid, error, &stat);
  12748.   ecount = ptk_elemcount(stid);
  12749.   if (stat == PSTRUCT_STATUS_NON_EXISTENT) 
  12750.   {
  12751.     *error = 1;   /* structure does not exist */
  12752.     return inserted;
  12753.   }
  12754.   if ((elemid <= 0) || (elemid > ecount)) 
  12755.   {
  12756.     *error = 2;   /* element does not exist */
  12757.     return inserted;
  12758.   }
  12759.   pcreate_store(&err, &store);
  12760.   ptk_inqelemtypesizecontent(stid, elemid, store, error, &elcont);
  12761.   /* write element content to terminal window */
  12762.   writeelemcontent(PTKEOUTPUT, &elcont);
  12763.   pinq_open_struct(&err, &structst, &name);
  12764.   /* PHIGS PLUS bits */
  12765.   if (structst == PSTRUCT_OPEN) 
  12766.   {
  12767.     switch (elcont.eltype)
  12768.     {
  12769.       case PELEM_POLYLINE3:
  12770.       case PELEM_POLYMARKER3:
  12771.       case PELEM_FILL_AREA3:
  12772.       case PELEM_POLYLINE:
  12773.       case PELEM_POLYMARKER:
  12774.       case PELEM_FILL_AREA:
  12775.       case PELEM_TEXT3:
  12776.       case PELEM_TEXT:
  12777.       case PELEM_ANNO_TEXT_REL3:
  12778.       case PELEM_ANNO_TEXT_REL:
  12779.       case PELEM_FILL_AREA_SET3:
  12780.       case PELEM_FILL_AREA_SET:
  12781.       case PELEM_CELL_ARRAY3:
  12782.       case PELEM_CELL_ARRAY:
  12783. #ifdef SUN
  12784.       case PELEM_POLYLINE_SET3_DATA:
  12785.       case PELEM_FILL_AREA_SET3_DATA:
  12786.       case PELEM_TRI_STRIP3_DATA:
  12787.       case PELEM_QUAD_MESH3_DATA:
  12788.       case PELEM_SET_OF_FILL_AREA_SET3_DATA:
  12789.       case PELEM_NUNI_BSP_CURVE:
  12790.       case PELEM_NUNI_BSP_SURF:
  12791.       case PELEM_CELL_ARRAY3_PLUS:      
  12792. #endif
  12793.         ptk_executeelem(&elcont);
  12794.         inserted = TRUE;
  12795.         break;
  12796.     }
  12797.   }
  12798.   ptk_delstore(store);
  12799.   return inserted;
  12800. }  /* ptk_elemcontent*/
  12801.  
  12802. /*--------------------------------------------------------------------------*/
  12803.  
  12804. /* end of phin.c */
  12805.